CVE-2025-38250
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
09/07/2025
Last modified:
10/07/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
Bluetooth: hci_core: Fix use-after-free in vhci_flush()<br />
<br />
syzbot reported use-after-free in vhci_flush() without repro. [0]<br />
<br />
From the splat, a thread close()d a vhci file descriptor while<br />
its device was being used by iotcl() on another thread.<br />
<br />
Once the last fd refcnt is released, vhci_release() calls<br />
hci_unregister_dev(), hci_free_dev(), and kfree() for struct<br />
vhci_data, which is set to hci_dev->dev->driver_data.<br />
<br />
The problem is that there is no synchronisation after unlinking<br />
hdev from hci_dev_list in hci_unregister_dev(). There might be<br />
another thread still accessing the hdev which was fetched before<br />
the unlink operation.<br />
<br />
We can use SRCU for such synchronisation.<br />
<br />
Let&#39;s run hci_dev_reset() under SRCU and wait for its completion<br />
in hci_unregister_dev().<br />
<br />
Another option would be to restore hci_dev->destruct(), which was<br />
removed in commit 587ae086f6e4 ("Bluetooth: Remove unused<br />
hci-destruct cb"). However, this would not be a good solution, as<br />
we should not run hci_unregister_dev() while there are in-flight<br />
ioctl() requests, which could lead to another data-race KCSAN splat.<br />
<br />
Note that other drivers seem to have the same problem, for exmaple,<br />
virtbt_remove().<br />
<br />
[0]:<br />
BUG: KASAN: slab-use-after-free in skb_queue_empty_lockless include/linux/skbuff.h:1891 [inline]<br />
BUG: KASAN: slab-use-after-free in skb_queue_purge_reason+0x99/0x360 net/core/skbuff.c:3937<br />
Read of size 8 at addr ffff88807cb8d858 by task syz.1.219/6718<br />
<br />
CPU: 1 UID: 0 PID: 6718 Comm: syz.1.219 Not tainted 6.16.0-rc1-syzkaller-00196-g08207f42d3ff #0 PREEMPT(full)<br />
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025<br />
Call Trace:<br />
<br />
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120<br />
print_address_description mm/kasan/report.c:408 [inline]<br />
print_report+0xd2/0x2b0 mm/kasan/report.c:521<br />
kasan_report+0x118/0x150 mm/kasan/report.c:634<br />
skb_queue_empty_lockless include/linux/skbuff.h:1891 [inline]<br />
skb_queue_purge_reason+0x99/0x360 net/core/skbuff.c:3937<br />
skb_queue_purge include/linux/skbuff.h:3368 [inline]<br />
vhci_flush+0x44/0x50 drivers/bluetooth/hci_vhci.c:69<br />
hci_dev_do_reset net/bluetooth/hci_core.c:552 [inline]<br />
hci_dev_reset+0x420/0x5c0 net/bluetooth/hci_core.c:592<br />
sock_do_ioctl+0xd9/0x300 net/socket.c:1190<br />
sock_ioctl+0x576/0x790 net/socket.c:1311<br />
vfs_ioctl fs/ioctl.c:51 [inline]<br />
__do_sys_ioctl fs/ioctl.c:907 [inline]<br />
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893<br />
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]<br />
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94<br />
entry_SYSCALL_64_after_hwframe+0x77/0x7f<br />
RIP: 0033:0x7fcf5b98e929<br />
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48<br />
RSP: 002b:00007fcf5c7b9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010<br />
RAX: ffffffffffffffda RBX: 00007fcf5bbb6160 RCX: 00007fcf5b98e929<br />
RDX: 0000000000000000 RSI: 00000000400448cb RDI: 0000000000000009<br />
RBP: 00007fcf5ba10b39 R08: 0000000000000000 R09: 0000000000000000<br />
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000<br />
R13: 0000000000000000 R14: 00007fcf5bbb6160 R15: 00007ffd6353d528<br />
<br />
<br />
Allocated by task 6535:<br />
kasan_save_stack mm/kasan/common.c:47 [inline]<br />
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68<br />
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]<br />
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394<br />
kasan_kmalloc include/linux/kasan.h:260 [inline]<br />
__kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4359<br />
kmalloc_noprof include/linux/slab.h:905 [inline]<br />
kzalloc_noprof include/linux/slab.h:1039 [inline]<br />
vhci_open+0x57/0x360 drivers/bluetooth/hci_vhci.c:635<br />
misc_open+0x2bc/0x330 drivers/char/misc.c:161<br />
chrdev_open+0x4c9/0x5e0 fs/char_dev.c:414<br />
do_dentry_open+0xdf0/0x1970 fs/open.c:964<br />
vfs_open+0x3b/0x340 fs/open.c:1094<br />
do_open fs/namei.c:3887 [inline]<br />
path_openat+0x2ee5/0x3830 fs/name<br />
---truncated---