]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Use proper nesting annotation for l2cap_chan lock
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 12 Nov 2014 20:22:21 +0000 (22:22 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 13 Nov 2014 06:49:09 +0000 (07:49 +0100)
commit7285542a27cad6ecbefb4f996c7320af0e225ee1
tree3b1b90b1c170c41bbd6fcdae92e8726024c37ade
parentedfd51d0c660504a7b8efde54db58e8040f35bcd
Bluetooth: Use proper nesting annotation for l2cap_chan lock

By default lockdep considers all L2CAP channels equal. This would mean
that we get warnings if a channel is locked when another one's lock is
tried to be acquired in the same thread. This kind of inter-channel
locking dependencies exist in the form of parent-child channels as well
as any channel wishing to elevate the security by requesting procedures
on the SMP channel.

To eliminate the chance for these lockdep warnings we introduce a
nesting level for each channel and use that when acquiring the channel
lock. For now there exists the earlier mentioned three identified
categories: SMP, "normal" channels and parent channels (i.e. those in
BT_LISTEN state). The nesting level is defined as atomic_t since we need
access to it before the lock is actually acquired.

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