In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: hci_event: fix LE list UAF on reset
hciccreset() 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:
hcirxwork 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 whitelistshow+0x15f/0x180 Read of size 1 at addr ffff8881015dab16 by task poc/95
Call Trace: whitelistshow+0x15f/0x180 seqreaditer+0x3ff/0x1190 seqread+0x267/0x3d0 vfsread+0x177/0xa20 ksys_read+0xf7/0x1c0
Allocated by task 91: hcibdaddrlistadd+0x1a6/0x3a0 hciccleaddtoacceptlist+0xab/0x140 hcicmdcompleteevt+0x26c/0x9a0 hcieventpacket+0x454/0xb20 hcirxwork+0x293/0x730
Freed by task 90: kfree+0x131/0x3c0 hcibdaddrlistclear+0xd8/0x160 hciccreset+0x28a/0x370 hcicmdcompleteevt+0x26c/0x9a0 hcieventpacket+0x454/0xb20 hcirxwork+0x293/0x730
Take hdev->lock around both list clears. This matches the existing mutation and traversal locking convention.