Bluetooth: Fix use-after-free in l2cap_sock_cleanup_listen()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1728137b33c00d5a2b5110ed7aafb42e7c32e4a1 · < 306b0991413b482dbf5585b423022123bb505966| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: Fix use-after-free in l2cap_sock_cleanup_listen()
syzbot reported the splat below without a repro.
In the splat, a single thread calling bt_accept_dequeue() freed sk and touched it after that.
The root cause would be the racy l2cap_sock_cleanup_listen() call added by the cited commit.
bt_accept_dequeue() is called under lock_sock() except for l2cap_sock_release().
Two threads could see the same socket during the list iteration in bt_accept_dequeue():
CPU1 CPU2 (close()) ---- ---- sock_hold(sk) sock_hold(sk); lock_sock(sk) <-- block close() sock_put(sk) bt_accept_unlink(sk) sock_put(sk) <-- refcnt by bt_accept_enqueue() release_sock(sk) lock_sock(sk) sock_put(sk) bt_accept_unlink(sk) sock_put(sk) <-- last refcnt bt_accept_unlink(sk) <-- UAF
From the CVE record · Linux
The Linux kernel has a use-after-free race in Bluetooth L2CAP socket cleanup. Concurrent socket operations, including a close, can cause the kernel to access a freed socket. The report does not establish whether an attacker can trigger it remotely or whether authentication is required.
Engineers running Linux kernels with Bluetooth L2CAP support should check their kernel versions; affected versions were not provided.