CVE-2022-50833: Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}timer works
syzbot is reporting attempt to schedule hdev->cmdwork work from systemwq WQ into hdev->workqueue WQ which is under draining operation [1], for commit c8efcc2589464ac7 ("workqueue: allow chained queueing during destruction") does not allow such operation.
The check introduced by commit 877afadad2dce8aa ("Bluetooth: When HCI work queue is drained, only queue chained work") was incomplete.
Use hdev->workqueue WQ when queuing hdev->{cmd,ncmd}timer works because hci{cmd,ncmd}timeout() calls queuework(hdev->workqueue). Also, protect the queuing operation with RCU read lock in order to avoid calling queuedelayedwork() after canceldelayedwork() completed.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.19 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.19.15 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.0.1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.0.2-1 - Compensating control
Queue hdev->{cmd,ncmd}_timer works on hdev->workqueue.
- Compensating control
Protect the queuing operation with an RCU read lock to prevent calling queue_delayed_work() after cancel_delayed_work() has completed.
Event History
Frequently Asked Questions
What conditions are implicated in triggering this issue?
The issue is associated with Bluetooth HCI command or command-count timer work being queued while the device workqueue is being drained. The problematic path involves scheduling work from the system workqueue into hdev->workqueue during its destruction or draining operation.
What does the fix change?
The fix queues the hdev command and command-count timer work on hdev->workqueue rather than the system workqueue. It also protects delayed-work queueing with an RCU read lock to prevent queue_delayed_work() from running after cancel_delayed_work() has completed.
How can I determine whether my kernel includes the resolution?
Check whether your kernel source or vendor patch set includes one of the referenced stable commits: c4635cf3d845a7324c25c52d549b70c8bd7ad4c7, 3c6b036fe5c8ed8b6c4cbdc03605929882907ef0, or deee93d13d385103205879a8a0915036ecd83261.