Bluetooth: hci_event: fix LE list UAF on reset
Subsystems (3)
PATCH 1/1 Bluetooth: hci_event: fix LE list UAF on reset
hci_cc_reset() clears the LE accept and resolving lists without taking hdev->lock. Other command-complete handlers serialize updates to these lists with that lock, and the debugfs readers hold it while walking them.
This permits the reset completion and a debugfs read to interleave as follows:
hci_rx_work debugfs reader
----------- --------------
lock hdev->lock
fetch current entry
list_del(entry)
kfree(entry)
read entry fields
The reader then dereferences a freed list entry and may follow its stale next pointer.
KASAN reported:
BUG: KASAN: slab-use-after-free in white_list_show+0x15f/0x180 Read of size 1 at addr ffff8881015dab16 by task poc/95 Call Trace: white_list_show+0x15f/0x180 seq_read_iter+0x3ff/0x1190 seq_read+0x267/0x3d0 vfs_read+0x177/0xa20 ksys_read+0xf7/0x1c0 Allocated by task 91: hci_bdaddr_list_add+0x1a6/0x3a0 hci_cc_le_add_to_accept_list+0xab/0x140 hci_cmd_complete_evt+0x26c/0x9a0 hci_event_packet+0x454/0xb20 hci_rx_work+0x293/0x730 Freed by task 90: kfree+0x131/0x3c0 hci_bdaddr_list_clear+0xd8/0x160 hci_cc_reset+0x28a/0x370 hci_cmd_complete_evt+0x26c/0x9a0 hci_event_packet+0x454/0xb20 hci_rx_work+0x293/0x730
Take hdev->lock around both list clears. This matches the existing mutation and traversal locking convention.
--- net/bluetooth/hci_event.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_event.c +2 -0
@@ -294,8 +294,10 @@ static u8 hci_cc_reset(struct hci_dev *hdev, void *data, struct sk_buff *skb) hdev->ssp_debug_mode =0 ; +hci_dev_lock (hdev);hci_bdaddr_list_clear (&hdev->le_accept_list);hci_bdaddr_list_clear (&hdev->le_resolv_list); +hci_dev_unlock (hdev);return rp->status; }
Signature · 1 line
2.43.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1137217
---Test result---
Test Summary:
CheckPatch PASS 0.55 seconds VerifyFixes PASS 0.07 seconds VerifySignedoff PASS 0.07 seconds GitLint PASS 0.20 seconds SubjectPrefix PASS 0.07 seconds BuildKernel PASS 26.67 seconds CheckAllWarning PASS 29.40 seconds CheckSparse PASS 27.88 seconds BuildKernel32 PASS 25.77 seconds CheckKernelLLVM SKIP 0.00 seconds TestRunnerSetup PASS 494.31 seconds TestRunner_l2cap-tester PASS 61.70 seconds TestRunner_iso-tester PASS 92.56 seconds TestRunner_bnep-tester PASS 19.62 seconds TestRunner_mgmt-tester FAIL 216.16 seconds TestRunner_rfcomm-tester PASS 25.08 seconds TestRunner_sco-tester PASS 31.17 seconds TestRunner_ioctl-tester PASS 25.89 seconds TestRunner_mesh-tester FAIL 25.84 seconds TestRunner_smp-tester PASS 22.77 seconds TestRunner_userchan-tester PASS 25.16 seconds TestRunner_6lowpan-tester PASS 22.94 seconds IncrementalBuild PASS 25.20 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.252 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.516 seconds Mesh - Send cancel - 2 Timed out 1.989 seconds
https://github.com/bluez/bluetooth-next/pull/513
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Thu, 30 Jul 2026 16:32:02 +0800 you wrote:
hci_cc_reset()clears the LE accept and resolving lists without takinghdev->lock. Other command-complete handlers serialize updates to these lists with that lock, and the debugfs readers hold it while walking them.This permits the reset completion and a debugfs read to interleave as follows:
[...]
Here is the summary with links:
- Bluetooth: hci_event: fix LE list UAF on reset
https://git.kernel.org/bluetooth/bluetooth-next/c/58356452043e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html