]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Bluetooth: Restore locking semantics when looking up L2CAP channels
authorMat Martineau <mathewm@codeaurora.org>
Fri, 27 Apr 2012 23:50:52 +0000 (16:50 -0700)
committerGustavo Padovan <gustavo@padovan.org>
Sun, 29 Apr 2012 20:27:46 +0000 (17:27 -0300)
commit62065ab3d37d7e71f44fb986ade6a285fa4c50fa
treefaae53929073071f07b5ca035bb6514c8df381ae
parent7f4ac3fd9b02d712ba8b009017ecbe8a29fe01ba
Bluetooth: Restore locking semantics when looking up L2CAP channels

As the comment for l2cap_get_chan_by_scid indicated, the function used
to return a locked socket.  The lock for the socket was acquired while
the channel list was also locked.

When locking was moved over to the l2cap_chan structure, the channel
lock was no longer acquired with the channel list still locked.  This
made it possible for the l2cap_chan to be deleted after
conn->chan_lock was released but before l2cap_chan_lock was called.
Making the call to l2cap_chan_lock before releasing conn->chan_lock
makes it impossible for the l2cap_chan to be deleted at the wrong
time.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
net/bluetooth/l2cap_core.c