Commit da3000c
Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user
[ Upstream commit 752a6c9 ]
After commit ab4eedb ("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: ab4eedb ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent f8b6ed2 commit da3000c
1 file changed
+8
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1686 | 1686 | | |
1687 | 1687 | | |
1688 | 1688 | | |
1689 | | - | |
1690 | 1689 | | |
1691 | 1690 | | |
1692 | 1691 | | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
1698 | 1696 | | |
1699 | | - | |
| 1697 | + | |
1700 | 1698 | | |
1701 | 1699 | | |
1702 | 1700 | | |
| |||
1717 | 1715 | | |
1718 | 1716 | | |
1719 | 1717 | | |
1720 | | - | |
| 1718 | + | |
1721 | 1719 | | |
1722 | 1720 | | |
1723 | 1721 | | |
1724 | 1722 | | |
1725 | 1723 | | |
1726 | 1724 | | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
| 1725 | + | |
1730 | 1726 | | |
1731 | 1727 | | |
1732 | 1728 | | |
| |||
1735 | 1731 | | |
1736 | 1732 | | |
1737 | 1733 | | |
1738 | | - | |
| 1734 | + | |
1739 | 1735 | | |
1740 | 1736 | | |
1741 | 1737 | | |
| |||
0 commit comments