syzbot


KASAN: use-after-free Read in hci_uart_write_work

Status: premoderation: reported on 2025/10/16 23:25
Reported-by: syzbot+1b4ec1f804f3ed61be32@syzkaller.appspotmail.com
First crash: 31d, last: 17d
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: use-after-free Read in hci_uart_write_work 19 1 51d 51d 0/2 premoderation: reported on 2025/09/26 00:52
android-6-1 KASAN: use-after-free Read in hci_uart_write_work 19 7 49d 69d 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 66d 66d 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 9 9d20h 125d 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+0x3df/0x6e0 drivers/bluetooth/hci_ldisc.c:165
Read of size 8 at addr ffff888147bd7860 by task kworker/1:3/298

CPU: 1 PID: 298 Comm: kworker/1:3 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Workqueue: events hci_uart_write_work
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0xe2/0x130 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 hci_uart_write_work+0x3df/0x6e0 drivers/bluetooth/hci_ldisc.c:165
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Allocated by task 40:
 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:430 [inline]
 __kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:463
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x5d/0x2f0 mm/slab.h:580
 slab_alloc_node mm/slub.c:2952 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 kmem_cache_alloc+0x165/0x2e0 mm/slub.c:2965
 kmem_cache_alloc_node include/linux/slab.h:423 [inline]
 __alloc_skb+0x9e/0x520 net/core/skbuff.c:200
 alloc_skb include/linux/skbuff.h:1126 [inline]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:391 [inline]
 hci_prepare_cmd net/bluetooth/hci_request.c:298 [inline]
 hci_req_add_ev+0x98/0x3c0 net/bluetooth/hci_request.c:332
 hci_req_add+0x30/0x40 net/bluetooth/hci_request.c:351
 bredr_init net/bluetooth/hci_core.c:202 [inline]
 hci_init1_req+0x13c/0x280 net/bluetooth/hci_core.c:258
 __hci_req_sync+0x136/0x7b0 net/bluetooth/hci_request.c:207
 __hci_init+0x2f/0x3b0 net/bluetooth/hci_core.c:907
 hci_dev_do_open+0xa61/0x1150 net/bluetooth/hci_core.c:1573
 hci_power_on+0x1b5/0x5b0 net/bluetooth/hci_core.c:2253
 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301
 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447
 kthread+0x346/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Freed by task 4767:
 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:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1600 [inline]
 slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
 slab_free mm/slub.c:3208 [inline]
 kmem_cache_free+0x100/0x2d0 mm/slub.c:3224
 kfree_skbmem+0x10c/0x180 net/core/skbuff.c:-1
 __kfree_skb net/core/skbuff.c:695 [inline]
 kfree_skb+0xc1/0x2f0 net/core/skbuff.c:713
 hci_uart_flush+0x95/0x320 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:489 [inline]
 tty_ldisc_kill+0x101/0x220 drivers/tty/tty_ldisc.c:637
 tty_ldisc_hangup+0x3df/0x4f0 drivers/tty/tty_ldisc.c:756
 __tty_hangup+0x60d/0x870 drivers/tty/tty_io.c:625
 tty_vhangup drivers/tty/tty_io.c:698 [inline]
 tty_ioctl+0x4d1/0xc60 drivers/tty/tty_io.c:2689
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:739
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888147bd7780
 which belongs to the cache skbuff_head_cache of size 248
The buggy address is located 224 bytes inside of
 248-byte region [ffff888147bd7780, ffff888147bd7878)
The buggy address belongs to the page:
page:ffffea00051ef5c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147bd7
flags: 0x4000000000000200(slab)
raw: 4000000000000200 ffffea0004dac0c0 0000000800000008 ffff888107d95200
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 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 277, ts 159912015445, free_ts 159852988905
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x179/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5370
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1813 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1874
 new_slab_objects mm/slub.c:2632 [inline]
 ___slab_alloc+0x2a6/0x450 mm/slub.c:2796
 __slab_alloc+0x63/0xa0 mm/slub.c:2836
 slab_alloc_node mm/slub.c:2918 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 kmem_cache_alloc+0x1af/0x2e0 mm/slub.c:2965
 kmem_cache_alloc_node include/linux/slab.h:423 [inline]
 __alloc_skb+0x9e/0x520 net/core/skbuff.c:200
 alloc_skb include/linux/skbuff.h:1126 [inline]
 __tcp_send_ack+0x9b/0x650 net/ipv4/tcp_output.c:3984
 tcp_send_ack+0x3b/0x60 net/ipv4/tcp_output.c:4016
 __tcp_ack_snd_check+0x3fd/0x8f0 net/ipv4/tcp_input.c:5538
 tcp_rcv_established+0x118d/0x19a0 net/ipv4/tcp_input.c:5973
 tcp_v4_do_rcv+0x4c1/0x7c0 net/ipv4/tcp_ipv4.c:1698
 tcp_v4_rcv+0x2157/0x26b0 net/ipv4/tcp_ipv4.c:2094
 ip_protocol_deliver_rcu+0x2f0/0x640 net/ipv4/ip_input.c:204
 ip_local_deliver_finish net/ipv4/ip_input.c:231 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 ip_local_deliver+0x2de/0x530 net/ipv4/ip_input.c:252
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 free_pcp_prepare mm/page_alloc.c:1421 [inline]
 free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336
 free_unref_page_list+0x12e/0x9b0 mm/page_alloc.c:3443
 release_pages+0xe38/0xe80 mm/swap.c:1103
 free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:356
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x175/0x300 mm/mmu_gather.c:326
 exit_mmap+0x2fc/0x540 mm/mmap.c:3387
 __mmput+0x93/0x2f0 kernel/fork.c:1153
 mmput+0x4e/0x150 kernel/fork.c:1176
 exit_mm kernel/exit.c:539 [inline]
 do_exit+0x9ae/0x2480 kernel/exit.c:859
 do_group_exit+0x141/0x310 kernel/exit.c:986
 __do_sys_exit_group kernel/exit.c:997 [inline]
 __se_sys_exit_group kernel/exit.c:995 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:995
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff888147bd7700: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
 ffff888147bd7780: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888147bd7800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc
                                                       ^
 ffff888147bd7880: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
 ffff888147bd7900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/30 02:31 android13-5.10-lts 2ece552169c2 fd2207e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in hci_uart_write_work
2025/10/16 23:24 android13-5.10-lts 2ece552169c2 19568248 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in hci_uart_write_work
* Struck through repros no longer work on HEAD.