alistair23-linux/net/bluetooth
Johan Hedberg f03567040c Bluetooth: Fix l2cap_sock_teardown_cb lockdep warning
Any code calling bt_accept_dequeue() to get a new child socket from a
server socket should use lock_sock_nested to avoid lockdep warnings due
to the parent and child sockets being locked at the same time. The
l2cap_sock_accept() function is already doing this correctly but a
second place calling bt_accept_dequeue() is the code path from
l2cap_sock_teardown_cb() that calls l2cap_sock_cleanup_listen().

This patch fixes the proper nested locking annotation and thereby avoids
the following style of lockdep warning.

[  +0.000224] [ INFO: possible recursive locking detected ]
[  +0.000222] 3.17.0+ #1153 Not tainted
[  +0.000130] ---------------------------------------------
[  +0.000227] l2cap-tester/562 is trying to acquire lock:
[  +0.000210]  (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+...}, at: [<c1393f47>] bt_accept_dequeue+0x68/0x11b
[  +0.000467]
but task is already holding lock:
[  +0.000186]  (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+...}, at: [<c13b949a>] lock_sock+0xa/0xc
[  +0.000421]
other info that might help us debug this:
[  +0.000199]  Possible unsafe locking scenario:

[  +0.000117]        CPU0
[  +0.000000]        ----
[  +0.000000]   lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
[  +0.000000]   lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
[  +0.000000]
 *** DEADLOCK ***

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2014-11-12 10:05:25 +01:00
..
bnep Bluetooth: Introduce BT_BREDR and BT_LE config options 2014-11-02 10:01:53 +02:00
cmtp Bluetooth: Introduce BT_BREDR and BT_LE config options 2014-11-02 10:01:53 +02:00
hidp Bluetooth: Introduce BT_BREDR and BT_LE config options 2014-11-02 10:01:53 +02:00
rfcomm Bluetooth: Fix sparse warnings in RFCOMM 2014-11-04 08:01:46 +01:00
6lowpan.c Bluetooth: 6lowpan: Remove unnecessary RCU callback 2014-11-11 14:26:02 +01:00
a2mp.c Bluetooth: Provide L2CAP ops callback for memcpy_fromiovec 2014-07-03 17:42:43 +02:00
a2mp.h
af_bluetooth.c Bluetooth: Add BUILD_BUG_ON check for SKB control buffer size 2014-09-15 07:15:41 +03:00
amp.c Bluetooth: Fix sparse warning in amp.c 2014-11-11 00:07:29 +01:00
amp.h
hci_conn.c Bluetooth: Fix check for direct advertising 2014-10-28 22:48:56 +01:00
hci_core.c Bluetooth: Consolidate whitelist debugfs entry into device_list 2014-11-03 10:13:42 +02:00
hci_event.c Bluetooth: Fix mgmt connected notification 2014-11-11 10:34:52 +01:00
hci_sock.c Bluetooth: spelling fixes 2014-10-28 17:23:58 +01:00
hci_sysfs.c Bluetooth: Convert to use ATTRIBUTE_GROUPS macro 2014-02-13 09:51:34 +02:00
Kconfig Bluetooth: Introduce BT_BREDR and BT_LE config options 2014-11-02 10:01:53 +02:00
l2cap_core.c Bluetooth: spelling fixes 2014-10-28 17:23:58 +01:00
l2cap_sock.c Bluetooth: Fix l2cap_sock_teardown_cb lockdep warning 2014-11-12 10:05:25 +01:00
lib.c Bluetooth: Convert bt_<level> logging functions to return void 2014-09-24 09:40:08 +02:00
Makefile Bluetooth: 6LoWPAN: Create a kernel module 2014-07-03 17:42:44 +02:00
mgmt.c Bluetooth: Fix invalid response for 'Start Discovery' command 2014-11-03 15:43:05 +02:00
sco.c Bluetooth: never linger on process exit 2014-07-17 12:13:06 +02:00
smp.c Bluetooth: spelling fixes 2014-10-28 17:23:58 +01:00
smp.h Bluetooth: Add smp_ltk_sec_level() helper function 2014-09-11 02:45:24 +02:00