linux/net/bluetooth
Juan Perdomo 801fb950ca Bluetooth: RFCOMM: avoid socket lock inversion in listener cleanup
rfcomm_sock_cleanup_listen() closes unaccepted child sockets through
rfcomm_sock_close(), which takes the child socket lock before
rfcomm_dlc_close() acquires rfcomm_mutex. The RFCOMM worker takes these
locks in reverse order while handling connections and DLC state changes,
so lockdep reports a possible deadlock.

Close dequeued children without taking their socket lock. The accept queue
owns a reference to each child, and bt_accept_dequeue() locks the child
while unlinking it and clearing its parent pointer.

Dropping the child lock makes it important to prevent a concurrent
rfcomm_connect_ind() from enqueueing a new child after cleanup observes an
empty queue. Set a listening socket to BT_CLOSED while its lock is still
held, before dropping the lock and draining the queue. The state check in
rfcomm_connect_ind() then rejects new children once cleanup starts.

Reported-by: syzbot+0cece8fa7d83523f47a3@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0cece8fa7d83523f47a3
Fixes: b7ce436a5d ("Bluetooth: switch to lock_sock in RFCOMM")
Signed-off-by: Juan Perdomo <jcperdomo100@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2026-09-15 14:55:41 -04:00
..
bnep Bluetooth: fix BT dependency for submodules 2026-08-07 15:38:30 -04:00
hidp Bluetooth: fix BT dependency for submodules 2026-08-07 15:38:30 -04:00
rfcomm Bluetooth: RFCOMM: avoid socket lock inversion in listener cleanup 2026-09-15 14:55:41 -04:00
6lowpan.c Bluetooth: add annotations for l2cap_data locking context 2026-08-07 15:38:32 -04:00
af_bluetooth.c Bluetooth: af_bluetooth: Add minimal context analysis annotations 2026-08-07 12:26:02 -04:00
aosp.c Bluetooth: aosp: Fix typo in comment 2025-07-23 10:30:18 -04:00
aosp.h Bluetooth: aosp: Support AOSP Bluetooth Quality Report 2021-11-02 19:37:52 +01:00
coredump.c Bluetooth: coredump: Quiesce dump work on unregister 2026-09-15 14:49:41 -04:00
ecdh_helper.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
ecdh_helper.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
eir.c Bluetooth: eir: validate service data length before reading UUID 2026-09-15 14:30:14 -04:00
eir.h Bluetooth: eir: Fix possible crashes on eir_create_adv_data 2025-06-11 16:29:22 -04:00
hci_codec.c Bluetooth: hci_codec: validate vendor codec count length 2026-09-15 14:52:12 -04:00
hci_codec.h Bluetooth: Add support for Read Local Supported Codecs V2 2021-09-07 14:09:18 -07:00
hci_conn.c Bluetooth: keep dst_type with dst when reusing an LE connection 2026-09-15 14:55:32 -04:00
hci_core.c Bluetooth: coredump: Quiesce dump work on unregister 2026-09-15 14:49:41 -04:00
hci_debugfs.c Bluetooth: simplify force_no_mitm_write() with kstrtobool_from_user() 2026-08-07 12:27:39 -04:00
hci_debugfs.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
hci_drv.c Bluetooth: Introduce HCI Driver protocol 2025-05-21 10:28:07 -04:00
hci_event.c Bluetooth: hci_event: clear HCI_LE_ADV only on a created connection 2026-08-24 13:11:42 -04:00
hci_sock.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
hci_sync.c Bluetooth: hci_sync: Serialize local codec list cleanup 2026-09-15 14:52:31 -04:00
hci_sysfs.c Bluetooth: hci_sysfs: Fix NULL pointer dereference in device_del() 2026-09-08 17:12:45 -04:00
iso.c Bluetooth: ISO: set BT_LISTEN before requesting a BIG sync 2026-09-15 14:53:12 -04:00
Kconfig Bluetooth: fix BT dependency for submodules 2026-08-07 15:38:30 -04:00
l2cap_core.c Bluetooth: L2CAP: clear FLAG_DEFER_SETUP only for same PID/PSM 2026-08-31 13:59:45 -04:00
l2cap_sock.c Bluetooth: L2CAP: fix race l2cap_sock_cleanup_listen() vs. put_chan 2026-08-24 13:06:49 -04:00
leds.c Bluetooth: Use led_set_brightness() in LED trigger activate() callback 2024-09-10 13:06:11 -04:00
leds.h
lib.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
Makefile Bluetooth: enable context analysis 2026-08-07 12:27:20 -04:00
mgmt_config.c Bluetooth: mgmt: Add idle_timeout to configurable system parameters 2026-01-29 13:24:22 -05:00
mgmt_config.h Bluetooth: mgmt: Add commands for runtime configuration 2020-06-18 13:11:03 +03:00
mgmt_util.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
mgmt_util.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
mgmt.c Bluetooth: mgmt: fix 'hdev->discovery.uuids' NULL dereference 2026-08-24 13:06:39 -04:00
msft.c Bluetooth: hci_core: Fix race condition during device registration 2026-08-31 13:52:54 -04:00
msft.h Bluetooth: msft: fix slab-use-after-free in msft_do_close() 2024-05-03 13:05:28 -04:00
sco.c Bluetooth: SCO: give the socket its own sco_conn reference 2026-07-28 16:13:48 -04:00
selftest.c Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
selftest.h Bluetooth: Add SPDX id lines to some source files 2026-06-11 14:24:41 -04:00
smp.c Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
smp.h Bluetooth: add annotations for l2cap_data locking context 2026-08-07 15:38:32 -04:00