Linux: Bluetooth: btqcomsmd: destroy RPMsg endpoints before freeing hci_dev
What fixes it
- 962dcc1d8a52e64428cae07806e7f6b8d3ec6ac0LinuxCVE List
- 2dcc2240b4e5f6e5dce1736f82666aba40eb3b13LinuxCVE List
- 2d016208a011558f211ec9687889df8318654730LinuxCVE List
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: btqcomsmd: destroy RPMsg endpoints before freeing hci_dev
The command and ACL RPMsg endpoints store struct btqcomsmd as their callback private data. The receive callbacks dereference btq->hdev without taking an hci_dev reference.
The current teardown order frees the hci_dev before destroying the RPMsg endpoints in both the hci_register_dev() error path and the driver remove path. If WCNSS delivers data in that window, the endpoint callback can run with an already freed hci_dev and pass it to the Bluetooth core.
For qcom_smd endpoints, rpmsg_destroy_ept() closes the channel and clears the callback under the channel recv_lock. The receive path holds the same lock while invoking the callback, so destroying the endpoints first both prevents new callbacks and serializes with any callback already running.
Destroy the command and ACL endpoints before hci_free_dev(). Keep hci_unregister_dev() first during remove so the HCI core stops issuing operations before the transport endpoints are shut down. In the full registration-error cleanup path, return directly after freeing the hci_dev to avoid falling through to the partial-construction labels and destroying the endpoints twice.
Text from CVE List
Affected versions 12
- Linuxaffected: 5052de8deff5619a9b7071f00084fd0264b58e17 before aaa7f676418e1eb2c4ef0d4e4b07812b25e7b404CVE List
- Linuxaffected: 5052de8deff5619a9b7071f00084fd0264b58e17 before 962dcc1d8a52e64428cae07806e7f6b8d3ec6ac0CVE List
- Linuxaffected: 5052de8deff5619a9b7071f00084fd0264b58e17 before 2dcc2240b4e5f6e5dce1736f82666aba40eb3b13CVE List
- Linuxaffected: 5052de8deff5619a9b7071f00084fd0264b58e17 before 2d016208a011558f211ec9687889df8318654730CVE List
- Linuxaffected: 5052de8deff5619a9b7071f00084fd0264b58e17 before f5a427b16e45210dee656b0860728f3d496dee85CVE List
- Linuxaffected: 4.12CVE List
- Linuxunaffected: all versions before 4.12CVE List
- Linuxunaffected: 6.6.160 through 6.6.*CVE List
- Linuxunaffected: 6.12.111 through 6.12.*CVE List
- Linuxunaffected: 6.18.53 through 6.18.*CVE List
- Linuxunaffected: 7.2.7 through 7.2.*CVE List
- Linuxunaffected: 7.3CVE List
References 5
- git.kernel.org/stable/c/aaa7f676418e1eb2c4ef0d4e4b07812b25e7b404Referencevia CVE List
- git.kernel.org/stable/c/962dcc1d8a52e64428cae07806e7f6b8d3ec6ac0Referencevia CVE List
- git.kernel.org/stable/c/2dcc2240b4e5f6e5dce1736f82666aba40eb3b13Referencevia CVE List
- git.kernel.org/stable/c/2d016208a011558f211ec9687889df8318654730Referencevia CVE List
- git.kernel.org/stable/c/f5a427b16e45210dee656b0860728f3d496dee85Referencevia CVE List