1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-25 17:53:34 -05:00
linux/net/bluetooth
Luiz Augusto von Dentz f1a8f402f1 Bluetooth: L2CAP: Fix deadlock
This fixes the following deadlock introduced by 39a92a55be13
("bluetooth/l2cap: sync sock recv cb and release")

============================================
WARNING: possible recursive locking detected
6.10.0-rc3-g4029dba6b6f1 #6823 Not tainted
--------------------------------------------
kworker/u5:0/35 is trying to acquire lock:
ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_sock_recv_cb+0x44/0x1e0

but task is already holding lock:
ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_get_chan_by_scid+0xaf/0xd0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&chan->lock#2/1);
  lock(&chan->lock#2/1);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by kworker/u5:0/35:
 #0: ffff888002b8a940 ((wq_completion)hci0#2){+.+.}-{0:0}, at:
process_one_work+0x750/0x930
 #1: ffff888002c67dd0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0},
at: process_one_work+0x44e/0x930
 #2: ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at:
l2cap_get_chan_by_scid+0xaf/0xd0

To fix the original problem this introduces l2cap_chan_lock at
l2cap_conless_channel to ensure that l2cap_sock_recv_cb is called with
chan->lock held.

Fixes: 89e856e124 ("bluetooth/l2cap: sync sock recv cb and release")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2024-06-28 14:32:02 -04:00
..
bnep
cmtp
hidp
rfcomm
6lowpan.c
af_bluetooth.c
aosp.c
aosp.h
coredump.c
ecdh_helper.c
ecdh_helper.h
eir.c
eir.h
hci_codec.c
hci_codec.h
hci_conn.c bluetooth/hci: disallow setting handle bigger than HCI_CONN_HANDLE_MAX 2024-06-28 14:30:50 -04:00
hci_core.c Bluetooth: L2CAP: Fix deadlock 2024-06-28 14:32:02 -04:00
hci_debugfs.c
hci_debugfs.h
hci_event.c Bluetooth: Ignore too large handle values in BIG 2024-06-28 14:30:40 -04:00
hci_request.c
hci_request.h
hci_sock.c
hci_sync.c Bluetooth: L2CAP: Fix deadlock 2024-06-28 14:32:02 -04:00
hci_sysfs.c
iso.c Bluetooth: ISO: Check socket flag instead of hcon 2024-06-28 14:30:46 -04:00
Kconfig
l2cap_core.c Bluetooth: L2CAP: Fix deadlock 2024-06-28 14:32:02 -04:00
l2cap_sock.c Bluetooth: L2CAP: Fix deadlock 2024-06-28 14:32:02 -04:00
leds.c
leds.h
lib.c
Makefile
mgmt.c
mgmt_config.c
mgmt_config.h
mgmt_util.c
mgmt_util.h
msft.c
msft.h
sco.c
selftest.c
selftest.h
smp.c
smp.h