]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user
authorShaurya Rane <ssrane_b23@ee.vjti.ac.in>
Thu, 6 Nov 2025 18:20:16 +0000 (23:50 +0530)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 12 Mar 2026 19:28:03 +0000 (15:28 -0400)
commit752a6c9596dd25efd6978a73ff21f3b592668f4a
treee841a530620c3b43c8f63bc5dd8a59d2b6975bfb
parentdbf666e4fc9bdd975a61bf682b3f75cb0145eedd
Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user

After commit ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in
hci_chan_del"), l2cap_conn_del() uses conn->lock to protect access to
conn->users. However, l2cap_register_user() and l2cap_unregister_user()
don't use conn->lock, creating a race condition where these functions can
access conn->users and conn->hchan concurrently with l2cap_conn_del().

This can lead to use-after-free and list corruption bugs, as reported
by syzbot.

Fix this by changing l2cap_register_user() and l2cap_unregister_user()
to use conn->lock instead of hci_dev_lock(), ensuring consistent locking
for the l2cap_conn structure.

Reported-by: syzbot+14b6d57fb728e27ce23c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=14b6d57fb728e27ce23c
Fixes: ab4eedb790ca ("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del")
Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/l2cap_core.c