CVE-2025-38250 Information
Description
In the Linux kernel the following vulnerability has been resolved:
Bluetooth: hci_core: Fix use-after-free in vhci_flush()
syzbot reported use-after-free in vhci_flush() without repro. [0]
From the splat a thread close()d a vhci file descriptor while its device was being used by iotcl() on another thread.
Once the last fd refcnt is released vhci_release() calls hci_unregister_dev() hci_free_dev() and kfree() for struct vhci_data which is set to hci_dev->dev->driver_data.
The problem is that there is no synchronisation after unlinking hdev from hci_dev_list in hci_unregister_dev(). There might be another thread still accessing the hdev which was fetched before the unlink operation.
We can use SRCU for such synchronisation.
Let’s run hci_dev_reset() under SRCU and wait for its completion in hci_unregister_dev().
Another option would be to restore hci_dev->destruct() which was removed in commit 587ae086f6e4 (\Bluetooth: Remove unused hci-destruct cb). However this would not be a good solution as we should not run hci_unregister_dev() while there are in-flight ioctl() requests which could lead to another data-race KCSAN splat.
Note that other drivers seem to have the same problem for exmaple virtbt_remove().
[0]: BUG: KASAN: slab-use-after-free in skb_queue_empty_lockless include/linux/skbuff.h:1891 [inline] BUG: KASAN: slab-use-after-free in skb_queue_purge_reason+0x99/0x360 net/core/skbuff.c:3937 Read of size 8 at addr ffff88807cb8d858 by task syz.1.219/6718
CPU: 1 UID: 0 PID: 6718 Comm: syz.1.219 Not tainted 6.16.0-rc1-syzkaller-00196-g08207f42d3ff 0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine BIOS Google 05/07/2025
Call Trace:
Allocated by task 6535: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4359 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] vhci_open+0x57/0x360 drivers/bluetooth/hci_vhci.c:635 misc_open+0x2bc/0x330 drivers/char/misc.c:161 chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414 do_dentry_open+0xdf0/0x1970 fs/open.c:964 vfs_open+0x3b/0x340 fs/open.c:1094 do_open fs/namei.c:3887 [inline] path_openat+0x2ee5/0x3830 fs/name
truncated—
Reference
https://git.kernel.org/stable/c/0e5c144c557df910ab64d9c25d06399a9a735e65 https://git.kernel.org/stable/c/1d6123102e9fbedc8d25bf4731da6d513173e49e https://git.kernel.org/stable/c/ce23b73f0f27e2dbeb81734a79db710f05aa33c6
Related CNNVD
CNNVD-202507-1291 (Published: 2025-07-09)
Share on: