CVE-2022-50374: Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure
syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1], for rcu_sync_enter() is called without rcu_sync_init() due to hci_uart_tty_open() ignoring percpu_init_rwsem() failure.
While we are at it, fix that hci_uart_register_device() ignores percpu_init_rwsem() failure and hci_uart_unregister_device() does not call percpu_free_rwsem().
The Linux kernel CVE team has assigned CVE-2022-50374 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.15 with commit 67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2 and fixed in 5.10.150 with commit d7cc0d51ffcbfd1caaa809fcf9cff05c46d0fb4d Issue introduced in 4.15 with commit 67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2 and fixed in 5.15.75 with commit b8917dce2134739b39bc0a5648b18427f2cad569 Issue introduced in 4.15 with commit 67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2 and fixed in 5.19.17 with commit 75b2c71ea581c7bb1303860d89366a42ad0506d2 Issue introduced in 4.15 with commit 67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2 and fixed in 6.0.3 with commit 98ce10f3f345e61fc6c83bff9cd11cda252b05ac Issue introduced in 4.15 with commit 67d2f8781b9f00d1089aafcfa3dc09fcd0f343e2 and fixed in 6.1 with commit 3124d320c22f3f4388d9ac5c8f37eaad0cefd6b1 Issue introduced in 4.14.63 with commit f6ec33f6bd3723a8146768106434ef6ab3d9d990 Issue introduced in 4.14.63 with commit 4a53c4e84ace1bc75157a7281af3fe8f5b19d08c
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-50374
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_serdev.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/d7cc0d51ffcbfd1caaa809fcf9cff05c46d0fb4d https://git.kernel.org/stable/c/b8917dce2134739b39bc0a5648b18427f2cad569 https://git.kernel.org/stable/c/75b2c71ea581c7bb1303860d89366a42ad0506d2 https://git.kernel.org/stable/c/98ce10f3f345e61fc6c83bff9cd11cda252b05ac https://git.kernel.org/stable/c/3124d320c22f3f4388d9ac5c8f37eaad0cefd6b1