syzbot


KASAN: use-after-free Read in hci_uart_write_work

Status: premoderation: reported on 2025/09/26 00:52
Reported-by: syzbot+98063884b8c7ee5ba888@syzkaller.appspotmail.com
First crash: 2d13h, last: 2d13h
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in hci_uart_write_work 19 7 12h35m 20d 0/2 premoderation: reported on 2025/09/08 09:39
android-6-12 KASAN: slab-use-after-free Read in hci_uart_write_work 19 1 17d 17d 0/1 premoderation: reported on 2025/09/11 04:00
upstream KASAN: slab-use-after-free Read in hci_uart_write_work bluetooth 19 syz 4 4d11h 75d 0/29 upstream: reported syz repro on 2025/07/14 17:09

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in hci_uart_write_work+0x43e/0x750 drivers/bluetooth/hci_ldisc.c:165
Read of size 8 at addr ffff888132a72c20 by task kworker/1:9/780

CPU: 1 PID: 780 Comm: kworker/1:9 Tainted: G        W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: events hci_uart_write_work
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0xf1/0x140 mm/kasan/report.c:444
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 hci_uart_write_work+0x43e/0x750 drivers/bluetooth/hci_ldisc.c:165
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 637:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 __kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:466
 kasan_slab_alloc include/linux/kasan.h:217 [inline]
 slab_post_alloc_hook+0x4f/0x2b0 mm/slab.h:550
 slab_alloc_node mm/slub.c:3245 [inline]
 slab_alloc mm/slub.c:3255 [inline]
 kmem_cache_alloc+0xf7/0x260 mm/slub.c:3260
 kmem_cache_alloc_node include/linux/slab.h:489 [inline]
 __alloc_skb+0xe0/0x740 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:392 [inline]
 hci_prepare_cmd net/bluetooth/hci_request.c:299 [inline]
 hci_req_add_ev+0x98/0x3c0 net/bluetooth/hci_request.c:333
 hci_req_add+0x30/0x40 net/bluetooth/hci_request.c:352
 bredr_init net/bluetooth/hci_core.c:203 [inline]
 hci_init1_req+0x13c/0x280 net/bluetooth/hci_core.c:259
 __hci_req_sync+0x136/0x7b0 net/bluetooth/hci_request.c:208
 __hci_init+0x2f/0x3b0 net/bluetooth/hci_core.c:915
 hci_dev_do_open+0xa61/0x1150 net/bluetooth/hci_core.c:1581
 hci_power_on+0x1b5/0x5b0 net/bluetooth/hci_core.c:2265
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 16431:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1754
 slab_free mm/slub.c:3526 [inline]
 kmem_cache_free+0x100/0x320 mm/slub.c:3544
 kfree_skbmem+0x10c/0x180 net/core/skbuff.c:-1
 __kfree_skb net/core/skbuff.c:758 [inline]
 kfree_skb_reason net/core/skbuff.c:778 [inline]
 kfree_skb+0xc1/0x2f0 net/core/skbuff.c:792
 hci_uart_flush+0x8b/0x390 drivers/bluetooth/hci_ldisc.c:235
 hci_uart_close drivers/bluetooth/hci_ldisc.c:268 [inline]
 hci_uart_tty_close+0x7a/0x220 drivers/bluetooth/hci_ldisc.c:539
 tty_ldisc_close drivers/tty/tty_ldisc.c:474 [inline]
 tty_ldisc_kill+0x101/0x1e0 drivers/tty/tty_ldisc.c:629
 tty_ldisc_hangup+0x3df/0x4f0 drivers/tty/tty_ldisc.c:749
 __tty_hangup+0x60d/0x820 drivers/tty/tty_io.c:639
 tty_vhangup drivers/tty/tty_io.c:711 [inline]
 tty_ioctl+0x4d1/0xc60 drivers/tty/tty_io.c:2750
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:860
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:860
 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888132a72b40
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 224 bytes inside of
 248-byte region [ffff888132a72b40, ffff888132a72c38)
The buggy address belongs to the page:
page:ffffea0004ca9c80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x132a72
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff8881081abe00
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 6659, ts 451489059013, free_ts 451124811603
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5808
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1937 [inline]
 new_slab+0xa1/0x4d0 mm/slub.c:2000
 ___slab_alloc+0x381/0x810 mm/slub.c:3033
 __slab_alloc+0x49/0x90 mm/slub.c:3120
 slab_alloc_node mm/slub.c:3211 [inline]
 slab_alloc mm/slub.c:3255 [inline]
 kmem_cache_alloc+0x138/0x260 mm/slub.c:3260
 kmem_cache_alloc_node include/linux/slab.h:489 [inline]
 __alloc_skb+0xe0/0x740 net/core/skbuff.c:416
 alloc_skb include/linux/skbuff.h:1183 [inline]
 alloc_skb_with_frags+0xa8/0x620 net/core/skbuff.c:6194
 sock_alloc_send_pskb+0x853/0x980 net/core/sock.c:2537
 unix_dgram_sendmsg+0x5ea/0x1880 net/unix/af_unix.c:1816
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
 __sys_sendmmsg+0x278/0x480 net/socket.c:2576
 __do_sys_sendmmsg net/socket.c:2605 [inline]
 __se_sys_sendmmsg net/socket.c:2602 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2602
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1472 [inline]
 free_pcp_prepare mm/page_alloc.c:1544 [inline]
 free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534
 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616
 free_the_page mm/page_alloc.c:805 [inline]
 __free_pages+0x6c/0x100 mm/page_alloc.c:5884
 free_pages+0x82/0x90 mm/page_alloc.c:5895
 kasan_depopulate_vmalloc_pte+0x6b/0x90 mm/kasan/shadow.c:354
 apply_to_pte_range mm/memory.c:2643 [inline]
 apply_to_pmd_range mm/memory.c:2687 [inline]
 apply_to_pud_range mm/memory.c:2723 [inline]
 apply_to_p4d_range mm/memory.c:2759 [inline]
 __apply_to_page_range+0x8cd/0xc70 mm/memory.c:2795
 apply_to_existing_page_range+0x38/0x50 mm/memory.c:2828
 kasan_release_vmalloc+0x97/0xb0 mm/kasan/shadow.c:464
 __purge_vmap_area_lazy+0xc05/0x1840 mm/vmalloc.c:1723
 _vm_unmap_aliases+0x2fd/0x380 mm/vmalloc.c:2126
 vm_remove_mappings mm/vmalloc.c:2619 [inline]
 __vunmap+0x66e/0x9e0 mm/vmalloc.c:2650
 __vfree mm/vmalloc.c:2709 [inline]
 vfree+0x8b/0xc0 mm/vmalloc.c:2740
 module_memfree+0x17/0x30 kernel/module.c:2150
 bpf_jit_free_exec+0x15/0x20 kernel/bpf/core.c:871
 bpf_jit_binary_free kernel/bpf/core.c:918 [inline]
 bpf_jit_free+0x98/0x240 kernel/bpf/core.c:931
 bpf_prog_free_deferred+0x5c7/0x6d0 kernel/bpf/core.c:2302

Memory state around the buggy address:
 ffff888132a72b00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
 ffff888132a72b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888132a72c00: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
                               ^
 ffff888132a72c80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888132a72d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
==================================================================
Bluetooth: hci0: command 0x1003 tx timeout
Bluetooth: hci0: command 0x1001 tx timeout
Bluetooth: hci0: command 0x1009 tx timeout

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/26 00:51 android13-5.15-lts 8d934e0056f7 0abd0691 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in hci_uart_write_work
* Struck through repros no longer work on HEAD.