Bluetooth: hci_core: Fix use-after-free in vhci_flush()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ bf18c7118cf83ad4b9aa476354b4a06bcb9d0c4f · < 0e5c144c557df910ab64d9c25d06399a9a735e65| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_core: Fix use-after-free in vhci_flush()
syzbot reported use-after-free in vhci_flush() without repro. [0]
From the splat, a thread close()d a vhci file descriptor while its device was being used by iotcl() on another thread.
Once the last fd refcnt is released, vhci_release() calls hci_unregister_dev(), hci_free_dev(), and kfree() for struct vhci_data, which is set to hci_dev->dev->driver_data.
The problem is that there is no synchronisation after unlinking hdev from hci_dev_list in hci_unregister_dev(). There might be another thread still accessing the hdev which was fetched before the unlink operation.
We can use SRCU for such synchronisation.
Let's run hci_dev_reset() under SRCU and wait for its completion in hci_unregister_dev().
From the CVE record · Linux
The Linux kernel has a use-after-free in Bluetooth virtual HCI device handling. A local user can trigger it when one thread closes a virtual HCI file descriptor while another thread uses the device through an ioctl call. The input does not establish whether authentication beyond local access or other user interaction is required.
Engineers running Linux kernels with Bluetooth virtual HCI support should check whether their kernel includes the fix; affected versions are not specified.