syzbot


KASAN: use-after-free Read in vhci_urb_enqueue (2)

Status: upstream: reported on 2025/06/15 13:28
Reported-by: syzbot+d01517cb8f3a4caaa89c@syzkaller.appspotmail.com
First crash: 1d05h, last: 1d05h
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in vhci_urb_enqueue 1 107d 107d 0/3 auto-obsoleted due to no activity on 2025/06/08 21:56

Sample crash report:
usb 34-1: SetAddress Request (3) to port 0
==================================================================
BUG: KASAN: use-after-free in kobject_put+0x29d/0x460 lib/kobject.c:757
Read of size 1 at addr ffff88807a5760e4 by task kworker/1:5/4215

CPU: 1 PID: 4215 Comm: kworker/1:5 Not tainted 5.15.185-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: usb_hub_wq hub_event
Call Trace:
 <TASK>
 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
 kobject_put+0x29d/0x460 lib/kobject.c:757
 vhci_urb_enqueue+0x99d/0xe90 drivers/usb/usbip/vhci_hcd.c:767
 usb_hcd_submit_urb+0x30f/0x19c0 drivers/usb/core/hcd.c:1559
 usb_start_wait_urb+0x111/0x4b0 drivers/usb/core/message.c:58
 usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
 usb_control_msg+0x22f/0x3e0 drivers/usb/core/message.c:153
 hub_set_address drivers/usb/core/hub.c:4669 [inline]
 hub_port_init+0xc6c/0x28f0 drivers/usb/core/hub.c:4981
 hub_port_connect drivers/usb/core/hub.c:5396 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5607 [inline]
 port_event drivers/usb/core/hub.c:5753 [inline]
 hub_event+0x2535/0x4fa0 drivers/usb/core/hub.c:5835
 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
 </TASK>

Allocated by task 4215:
 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:604 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 usb_alloc_dev+0x59/0xd40 drivers/usb/core/usb.c:704
 hub_port_connect drivers/usb/core/hub.c:5369 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5607 [inline]
 port_event drivers/usb/core/hub.c:5753 [inline]
 hub_event+0x1eb2/0x4fa0 drivers/usb/core/hub.c:5835
 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 1165:
 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:1705 [inline]
 slab_free_freelist_hook+0xea/0x170 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4559
 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
 vhci_device_reset+0x61/0x150 drivers/usb/usbip/vhci_hcd.c:1081
 event_handler+0x302/0x470 drivers/usb/usbip/usbip_event.c:85
 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

Last potentially related work creation:
 kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x179/0x920 kernel/rcu/tree.c:3087
 netlink_release+0x134f/0x1790 net/netlink/af_netlink.c:800
 __sock_release net/socket.c:649 [inline]
 sock_close+0xd5/0x240 net/socket.c:1336
 __fput+0x234/0x930 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Second to last potentially related work creation:
 kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x179/0x920 kernel/rcu/tree.c:3087
 netlink_release+0x134f/0x1790 net/netlink/af_netlink.c:800
 __sock_release net/socket.c:649 [inline]
 sock_close+0xd5/0x240 net/socket.c:1336
 __fput+0x234/0x930 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88807a576000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 228 bytes inside of
 2048-byte region [ffff88807a576000, ffff88807a576800)
The buggy address belongs to the page:
page:ffffea0001e95c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7a570
head:ffffea0001e95c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016842000
raw: 0000000000000000 0000000000080008 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3547, ts 14333194021, free_ts 11935707390
 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:5474
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 __kmalloc+0x1cd/0x330 mm/slub.c:4403
 kmalloc include/linux/slab.h:609 [inline]
 sk_prot_alloc+0xe7/0x210 net/core/sock.c:1864
 sk_alloc+0x2f/0x310 net/core/sock.c:1917
 __netlink_create+0x6b/0x2d0 net/netlink/af_netlink.c:630
 netlink_create+0x3a7/0x510 net/netlink/af_netlink.c:693
 __sock_create+0x47b/0x900 net/socket.c:1486
 sock_create net/socket.c:1542 [inline]
 __sys_socket+0xe2/0x170 net/socket.c:1584
 __do_sys_socket net/socket.c:1593 [inline]
 __se_sys_socket net/socket.c:1591 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1591
 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
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_contig_range+0x96/0xf0 mm/page_alloc.c:9393
 destroy_args+0xef/0x8b0 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x318/0x370 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x1ee/0x680 init/main.c:1302
 do_initcall_level+0x137/0x1f0 init/main.c:1375
 do_initcalls+0x4b/0x90 init/main.c:1391
 kernel_init_freeable+0x3ce/0x560 init/main.c:1615
 kernel_init+0x19/0x1b0 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff88807a575f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807a576000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807a576080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88807a576100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807a576180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/15 13:27 linux-5.15.y 1c700860e8bc 5f4b362d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in vhci_urb_enqueue
* Struck through repros no longer work on HEAD.