syzbot


KASAN: use-after-free Write in detach_timer

Status: upstream: reported C repro on 2025/12/11 21:59
Reported-by: syzbot+66c971bd055d6950cf56@syzkaller.appspotmail.com
First crash: 13h03m, last: 9h23m
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in detach_timer batman mm tomoyo 24 4 951d 956d 0/29 auto-obsoleted due to no activity on 2023/08/03 11:53

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __hlist_del include/linux/list.h:858 [inline]
BUG: KASAN: use-after-free in detach_timer+0x12e/0x2b0 kernel/time/timer.c:827
Write of size 8 at addr ffff888024ba8848 by task kworker/0:21/4290

CPU: 0 PID: 4290 Comm: kworker/0:21 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Workqueue: usb_hub_wq hub_event
Call Trace:
 <IRQ>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 __hlist_del include/linux/list.h:858 [inline]
 detach_timer+0x12e/0x2b0 kernel/time/timer.c:827
 expire_timers kernel/time/timer.c:1485 [inline]
 __run_timers+0x4ab/0x7c0 kernel/time/timer.c:1767
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
 handle_softirqs+0x328/0x820 kernel/softirq.c:576
 __do_softirq kernel/softirq.c:610 [inline]
 invoke_softirq kernel/softirq.c:450 [inline]
 __irq_exit_rcu+0x12f/0x220 kernel/softirq.c:659
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:671
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:console_unlock+0xd90/0x1200 kernel/printk/printk.c:2749
Code: 00 48 83 7c 24 28 00 75 19 e8 4c 94 18 00 eb 18 e8 45 94 18 00 e8 80 af 42 08 48 83 7c 24 28 00 74 e7 e8 33 94 18 00 fb 31 ff <89> de e8 89 97 18 00 85 db 0f 94 c0 22 44 24 17 3c 01 75 1f e8 17
RSP: 0018:ffffc900032ef2e0 EFLAGS: 00000246
RAX: ffffffff815f37dd RBX: 0000000000000000 RCX: ffff88802cc23b80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900032ef550 R08: dffffc0000000000 R09: fffffbfff1ff5419
R10: fffffbfff1ff5419 R11: 1ffffffff1ff5418 R12: 1ffffffff194c7e9
R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffffffff194c7e2
 vprintk_emit+0xc0/0x150 kernel/printk/printk.c:2274
 dev_vprintk_emit+0x2cc/0x350 drivers/base/core.c:4638
 dev_printk_emit+0xdd/0x120 drivers/base/core.c:4649
 _dev_info+0x107/0x150 drivers/base/core.c:4707
 usb_disconnect+0xec/0x8a0 drivers/usb/core/hub.c:2269
 hub_port_connect drivers/usb/core/hub.c:5341 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
 port_event drivers/usb/core/hub.c:5799 [inline]
 hub_event+0x1e9f/0x5560 drivers/usb/core/hub.c:5881
 process_one_work+0x863/0x1000 kernel/workqueue.c:2310
 process_scheduled_works kernel/workqueue.c:2373 [inline]
 worker_thread+0xdca/0x12a0 kernel/workqueue.c:2459
 kthread+0x436/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 4218:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:607 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 __snd_usbmidi_create+0xda/0x2f90 sound/usb/midi.c:2539
 snd_usb_create_quirk sound/usb/quirks.c:577 [inline]
 create_composite_quirk+0x1ec/0x4e0 sound/usb/quirks.c:48
 usb_audio_probe+0xb72/0x1d50 sound/usb/card.c:885
 usb_probe_interface+0x5a0/0xaf0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x284/0xc80 drivers/base/dd.c:595
 __driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
 __device_attach+0x29b/0x460 drivers/base/dd.c:979
 bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
 device_add+0xa00/0xfb0 drivers/base/core.c:3412
 usb_set_configuration+0x1991/0x1fd0 drivers/usb/core/message.c:2165
 usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x139/0x270 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x284/0xc80 drivers/base/dd.c:595
 __driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
 __device_attach+0x29b/0x460 drivers/base/dd.c:979
 bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
 device_add+0xa00/0xfb0 drivers/base/core.c:3412
 usb_new_device+0xd53/0x1640 drivers/usb/core/hub.c:2632
 hub_port_connect drivers/usb/core/hub.c:5497 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
 port_event drivers/usb/core/hub.c:5799 [inline]
 hub_event+0x2dd9/0x5560 drivers/usb/core/hub.c:5881
 process_one_work+0x863/0x1000 kernel/workqueue.c:2310
 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
 kthread+0x436/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 4218:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1710 [inline]
 slab_free_freelist_hook+0xea/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 snd_rawmidi_free+0x3b7/0x3e0 sound/core/rawmidi.c:1844
 snd_rawmidi_dev_free+0x34/0x40 sound/core/rawmidi.c:1853
 __snd_device_free+0x1cd/0x2e0 sound/core/device.c:76
 snd_device_free_all+0xcb/0x180 sound/core/device.c:233
 snd_card_do_free sound/core/init.c:588 [inline]
 release_card_device+0x6d/0x1f0 sound/core/init.c:145
 device_release+0x92/0x1c0 drivers/base/core.c:-1
 kobject_cleanup lib/kobject.c:713 [inline]
 kobject_release lib/kobject.c:744 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x21d/0x460 lib/kobject.c:761
 snd_card_free_when_closed sound/core/init.c:620 [inline]
 snd_card_free+0x123/0x190 sound/core/init.c:653
 usb_audio_probe+0x187f/0x1d50 sound/usb/card.c:939
 usb_probe_interface+0x5a0/0xaf0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x284/0xc80 drivers/base/dd.c:595
 __driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
 __device_attach+0x29b/0x460 drivers/base/dd.c:979
 bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
 device_add+0xa00/0xfb0 drivers/base/core.c:3412
 usb_set_configuration+0x1991/0x1fd0 drivers/usb/core/message.c:2165
 usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x139/0x270 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x284/0xc80 drivers/base/dd.c:595
 __driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
 __device_attach+0x29b/0x460 drivers/base/dd.c:979
 bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
 device_add+0xa00/0xfb0 drivers/base/core.c:3412
 usb_new_device+0xd53/0x1640 drivers/usb/core/hub.c:2632
 hub_port_connect drivers/usb/core/hub.c:5497 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
 port_event drivers/usb/core/hub.c:5799 [inline]
 hub_event+0x2dd9/0x5560 drivers/usb/core/hub.c:5881
 process_one_work+0x863/0x1000 kernel/workqueue.c:2310
 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
 kthread+0x436/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff888024ba8800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 72 bytes inside of
 1024-byte region [ffff888024ba8800, ffff888024ba8c00)
The buggy address belongs to the page:
page:ffffea000092ea00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888024baf800 pfn:0x24ba8
head:ffffea000092ea00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001edf408 ffffea00008f6a08 ffff888016841dc0
raw: ffff888024baf800 000000000010000d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 144, ts 67897560147, free_ts 67883108033
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
 alloc_slab_page mm/slub.c:1780 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 __kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4963
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x22c/0x750 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1162 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 inet6_rt_notify+0xdd/0x290 net/ipv6/route.c:6181
 fib6_del_route net/ipv6/ip6_fib.c:1996 [inline]
 fib6_del+0x1082/0x1500 net/ipv6/ip6_fib.c:2031
 fib6_clean_node+0x296/0x580 net/ipv6/ip6_fib.c:2193
 fib6_walk_continue+0x640/0x8c0 net/ipv6/ip6_fib.c:2115
 fib6_walk+0x149/0x290 net/ipv6/ip6_fib.c:2163
 fib6_clean_tree net/ipv6/ip6_fib.c:2243 [inline]
 __fib6_clean_all+0x20e/0x350 net/ipv6/ip6_fib.c:2259
 rt6_sync_down_dev net/ipv6/route.c:4915 [inline]
 rt6_disable_ip+0x11f/0x690 net/ipv6/route.c:4920
 addrconf_ifdown+0x149/0x1970 net/ipv6/addrconf.c:3775
 addrconf_notify+0x445/0xf00 net/ipv6/addrconf.c:-1
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x94/0x280 mm/page_alloc.c:3396
 free_slab mm/slub.c:2020 [inline]
 discard_slab mm/slub.c:2026 [inline]
 __unfreeze_partials+0x1a5/0x200 mm/slub.c:2512
 put_cpu_partial+0x12d/0x190 mm/slub.c:2592
 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3225 [inline]
 kmem_cache_alloc_node+0x12d/0x2d0 mm/slub.c:3261
 __alloc_skb+0xf4/0x750 net/core/skbuff.c:415
 alloc_skb include/linux/skbuff.h:1162 [inline]
 alloc_skb_with_frags+0xa7/0x730 net/core/skbuff.c:6170
 sock_alloc_send_pskb+0x853/0x980 net/core/sock.c:2536
 unix_dgram_sendmsg+0x5ef/0x1890 net/unix/af_unix.c:1809
 sock_sendmsg_nosec net/socket.c:706 [inline]
 __sock_sendmsg net/socket.c:718 [inline]
 __sys_sendto+0x423/0x580 net/socket.c:2073
 __do_sys_sendto net/socket.c:2085 [inline]
 __se_sys_sendto net/socket.c:2081 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2081
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80

Memory state around the buggy address:
 ffff888024ba8700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888024ba8780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888024ba8800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff888024ba8880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888024ba8900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	00 48 83             	add    %cl,-0x7d(%rax)
   3:	7c 24                	jl     0x29
   5:	28 00                	sub    %al,(%rax)
   7:	75 19                	jne    0x22
   9:	e8 4c 94 18 00       	call   0x18945a
   e:	eb 18                	jmp    0x28
  10:	e8 45 94 18 00       	call   0x18945a
  15:	e8 80 af 42 08       	call   0x842af9a
  1a:	48 83 7c 24 28 00    	cmpq   $0x0,0x28(%rsp)
  20:	74 e7                	je     0x9
  22:	e8 33 94 18 00       	call   0x18945a
  27:	fb                   	sti
  28:	31 ff                	xor    %edi,%edi
* 2a:	89 de                	mov    %ebx,%esi <-- trapping instruction
  2c:	e8 89 97 18 00       	call   0x1897ba
  31:	85 db                	test   %ebx,%ebx
  33:	0f 94 c0             	sete   %al
  36:	22 44 24 17          	and    0x17(%rsp),%al
  3a:	3c 01                	cmp    $0x1,%al
  3c:	75 1f                	jne    0x5d
  3e:	e8                   	.byte 0xe8
  3f:	17                   	(bad)

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/12/12 01:39 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in detach_timer
2025/12/11 21:58 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in detach_timer
* Struck through repros no longer work on HEAD.