Bluetooth: L2CAP: Fix use-after-free in l2cap_unregister_user
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
18ab6b6078fa8191ca30a3065d57bf35d5635761| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
A locking race in the Linux kernel’s Bluetooth L2CAP code can cause use-after-free and list corruption when user registration or unregistration overlaps with connection deletion. The input does not specify an attack path, authentication requirements, or user interaction.
Engineers running Linux kernels with the affected Bluetooth L2CAP code should check their versions; affected versions are not specified.