Bluetooth: Fix reference counting of global L2CAP channels
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 7 Aug 2014 19:56:42 +0000 (22:56 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 14 Aug 2014 06:49:11 +0000 (08:49 +0200)
commita24cce144b9814a17f46006dbad6056f1f5f481e
tree58692975c72de95cdda4b3c0a68db88ac4166a12
parent2b29349044cc2cf74d4c6e23e26cd27977d91353
Bluetooth: Fix reference counting of global L2CAP channels

When looking up entries from the global L2CAP channel list there needs
to be a guarantee that other code doesn't go and remove the entry after
a channel has been returned by the lookup function. This patch makes
sure that the channel reference is incremented before the read lock is
released in the global channel lookup functions. The patch also adds the
corresponding l2cap_chan_put() calls once the channels pointers are
no-longer needed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/l2cap_core.c