CVE-2023-54038: Bluetooth: hci_conn: return ERR_PTR instead of NULL when there is no link
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_conn: return ERR_PTR instead of NULL when there is no link
hci_connect_sco currently returns NULL when there is no link (i.e. when hci_conn_link() returns NULL).
sco_connect() expects an ERR_PTR in case of any error (see line 266 in sco.c). Thus, hcon set as NULL passes through to sco_conn_add(), which tries to get hcon->hdev, resulting in dereferencing a NULL pointer as reported by syzkaller.
The same issue exists for iso_connect_cis() calling hci_connect_cis().
Thus, make hci_connect_sco() and hci_connect_cis() return ERR_PTR instead of NULL.
The Linux kernel CVE team has assigned CVE-2023-54038 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.4 with commit 06149746e7203d5ffe2d6faf9799ee36203aa8b8 and fixed in 6.4.7 with commit 357ab53c83a5322437fa434e9a9e3e0bafe6b383 Issue introduced in 6.4 with commit 06149746e7203d5ffe2d6faf9799ee36203aa8b8 and fixed in 6.5 with commit b4066eb04bb67e7ff66e5aaab0db4a753f37eaad Issue introduced in 6.3.8 with commit f72fc94a17d45be98aecfd59c39b5b24a6a342e2
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-2023-54038
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:
net/bluetooth/hci_conn.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/357ab53c83a5322437fa434e9a9e3e0bafe6b383 https://git.kernel.org/stable/c/b4066eb04bb67e7ff66e5aaab0db4a753f37eaad