Bluetooth: L2CAP: access chan->conn safely in get/setsockopt
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ d3b739db5dc6f688a60d56da872fabaf65246032 · < 8460dc49c9756a1e9288218060b4d41e1b704905| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: L2CAP: access chan->conn safely in get/setsockopt
Since commit b66774b48dd9 ("Bluetooth: L2CAP: Fix UAF in channel timeout by holding conn ref") l2cap_chan::conn has held reference and remains non-NULL also after the corresponding hci_conn is deleted. In this state accessing various fields eg. hci_conn::hdev is invalid, which leads to KASAN crash in l2cap_sock_setsockopt() access of conn->hcon->hdev.
Check l2cap_chan::conn.hcon corresponds to an alive hci_conn before trying to use it in l2cap_sock.c. Hold l2cap_chan_lock() in getsockopt/setsockopt to ensure it stays alive, and to avoid data races in l2cap_chan fields.
From the CVE record · Linux
The Linux kernel's Bluetooth L2CAP socket-option handlers can access an invalid connection field after the corresponding HCI connection is deleted, causing a KASAN crash. The input does not specify whether exploitation requires local or network access, authentication, or user interaction.
Engineers running Linux kernels with the affected Bluetooth L2CAP code should check their kernel versions; affected versions are not specified.