CVE-2022-50339: Bluetooth: avoid hci_dev_test_and_set_flag() in mgmt_init_hdev()
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: avoid hcidevtestandsetflag() in mgmtinithdev()
syzbot is again reporting attempt to cancel uninitialized work at mgmtindexremoved() [1], for setting of HCIMGMT flag from mgmtinithdev() from hcimgmtcmd() from hcisocksendmsg() can race with testing of HCIMGMT flag from mgmtindexremoved() from hcisockbind() due to lack of serialization via hcidevlock().
Since mgmtinithdev() is called with mgmtchanlistlock held, we can safely split hcidevtestandsetflag() into hcidevtestflag() and hcidevsetflag(). Thus, in order to close this race, set HCIMGMT flag after INITDELAYEDWORK() completed.
This is a local fix based on mgmtchanlistlock. Lack of serialization via hcidevlock() might be causing different race conditions somewhere else. But a global fix based on hcidevlock() should deserve a future patch.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.0.3-1 - Compensating control
In mgmt_init_hdev(), replace hci_dev_test_and_set_flag() with hci_dev_test_flag() followed by hci_dev_set_flag(), and set the HCI_MGMT flag only after INIT_DELAYED_WORK() has completed.
Event History
Frequently Asked Questions
What is the severity of CVE-2022-50339?
CVE-2022-50339 is classified as a vulnerability in the Linux kernel that affects Bluetooth functionality.
How do I fix CVE-2022-50339?
To fix CVE-2022-50339, update your Linux kernel to version 6.0.4 or later.
What versions of the Linux kernel are affected by CVE-2022-50339?
CVE-2022-50339 affects Linux kernel versions from 6.0 to 6.0.3.
What component does CVE-2022-50339 affect within the Linux kernel?
CVE-2022-50339 primarily affects the Bluetooth component of the Linux kernel.
Is CVE-2022-50339 exploitable remotely?
The details regarding remote exploitability for CVE-2022-50339 are not specifically noted, but it affects Bluetooth, which could pose risks if improperly managed.