KASAN: use-after-free Read in sd_stopN

Status: upstream: reported on 2026/08/05 01:57
Reported-by: syzbot+76e9b4198eb68d029028@syzkaller.appspotmail.com
First crash: 1d23h, last: 1d23h

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __create_pipe include/linux/usb.h:1959 [inline]
BUG: KASAN: use-after-free in cit_write_reg drivers/media/usb/gspca/xirlink_cit.c:671 [inline]
BUG: KASAN: use-after-free in sd_stopN+0xbb/0xc0 drivers/media/usb/gspca/xirlink_cit.c:2703
Read of size 4 at addr ffff888056b4f000 by task syz.3.29/4507

CPU: 1 PID: 4507 Comm: syz.3.29 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:420
 kasan_report+0x10b/0x140 mm/kasan/report.c:524
 __create_pipe include/linux/usb.h:1959 [inline]
 cit_write_reg drivers/media/usb/gspca/xirlink_cit.c:671 [inline]
 sd_stopN+0xbb/0xc0 drivers/media/usb/gspca/xirlink_cit.c:2703
 gspca_stream_off+0xad/0x3f0 drivers/media/usb/gspca/gspca.c:742
 gspca_stop_streaming+0x44/0x1e0 drivers/media/usb/gspca/gspca.c:1370
 __vb2_queue_cancel+0xa6/0xd80 drivers/media/common/videobuf2/videobuf2-core.c:2027
 vb2_core_streamoff drivers/media/common/videobuf2/videobuf2-core.c:2184 [inline]
 __vb2_cleanup_fileio+0x4e/0x1f0 drivers/media/common/videobuf2/videobuf2-core.c:2754
 vb2_core_queue_release+0x13/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2474
 vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:934 [inline]
 _vb2_fop_release drivers/media/common/videobuf2/videobuf2-v4l2.c:1119 [inline]
 vb2_fop_release+0x160/0x1e0 drivers/media/common/videobuf2/videobuf2-v4l2.c:1133
 v4l2_release+0x25f/0x390 drivers/media/v4l2-core/v4l2-dev.c:459
 __fput+0x20a/0x8b0 fs/file_table.c:320
 task_work_run+0x1d0/0x260 kernel/task_work.c:203
 exit_task_work include/linux/task_work.h:39 [inline]
 do_exit+0x9d5/0x2570 kernel/exit.c:887
 do_group_exit+0x229/0x2e0 kernel/exit.c:1030
 get_signal+0x1259/0x1340 kernel/signal.c:2880
 arch_do_signal_or_restart+0xc4/0x1310 arch/x86/kernel/signal.c:871
 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fdd3c99e019
Code: Unable to access opcode bytes at 0x7fdd3c99dfef.
RSP: 002b:00007fdd3d82f028 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: fffffffffffffe00 RBX: 00007fdd3cc26180 RCX: 00007fdd3c99e019
RDX: 0000000000001000 RSI: 0000200000000600 RDI: 0000000000000008
RBP: 00007fdd3ca3500c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fdd3cc26218 R14: 00007fdd3cc26180 R15: 00007ffccae6d218
 </TASK>

Allocated by task 4433:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 ____kasan_kmalloc mm/kasan/common.c:375 [inline]
 __kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:384
 kmalloc include/linux/slab.h:563 [inline]
 kzalloc include/linux/slab.h:699 [inline]
 usb_alloc_dev+0x5b/0xda0 drivers/usb/core/usb.c:658
 hub_port_connect drivers/usb/core/hub.c:5419 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5657 [inline]
 port_event drivers/usb/core/hub.c:5817 [inline]
 hub_event+0x20cb/0x5200 drivers/usb/core/hub.c:5899
 process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 4314:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1f0 mm/kasan/common.c:237
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1729 [inline]
 slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1755
 slab_free mm/slub.c:3687 [inline]
 __kmem_cache_free+0xb6/0x200 mm/slub.c:3700
 device_release+0x92/0x1c0 drivers/base/core.c:-1
 kobject_cleanup lib/kobject.c:681 [inline]
 kobject_release lib/kobject.c:712 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x217/0x450 lib/kobject.c:729
 hub_port_connect drivers/usb/core/hub.c:5361 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5657 [inline]
 port_event drivers/usb/core/hub.c:5817 [inline]
 hub_event+0x1d27/0x5200 drivers/usb/core/hub.c:5899
 process_one_work+0x8ab/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaf5/0x12a0 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888056b4f000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 0 bytes inside of
 2048-byte region [ffff888056b4f000, ffff888056b4f800)

The buggy address belongs to the physical page:
page:ffffea00015ad200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888056b49000 pfn:0x56b48
head:ffffea00015ad200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000adc808 ffffea000164dc08 ffff888017442000
raw: ffff888056b49000 0000000000080007 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 4271, tgid 4271 (syz-executor), ts 73800536048, free_ts 23697327884
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560
 prep_new_page mm/page_alloc.c:2567 [inline]
 get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358
 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658
 alloc_slab_page+0x5d/0x180 mm/slub.c:1799
 allocate_slab mm/slub.c:1944 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:1997
 ___slab_alloc+0xbc5/0x1240 mm/slub.c:3154
 __slab_alloc mm/slub.c:3240 [inline]
 slab_alloc_node mm/slub.c:3325 [inline]
 __kmem_cache_alloc_node+0x126/0x270 mm/slub.c:3398
 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026
 kmalloc include/linux/slab.h:563 [inline]
 rtnl_newlink+0x10f/0x1f90 net/core/rtnetlink.c:3665
 rtnetlink_rcv_msg+0x863/0xfb0 net/core/rtnetlink.c:6166
 netlink_rcv_skb+0x1ef/0x440 net/netlink/af_netlink.c:2516
 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
 netlink_unicast+0x7ad/0x920 net/netlink/af_netlink.c:1344
 netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1877
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 __sys_sendto+0x497/0x650 net/socket.c:2153
 __do_sys_sendto net/socket.c:2165 [inline]
 __se_sys_sendto net/socket.c:2161 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2161
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1487 [inline]
 free_pcp_prepare mm/page_alloc.c:1537 [inline]
 free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3509
 free_contig_range+0x9d/0x150 mm/page_alloc.c:9626
 destroy_args+0xef/0xa0e mm/debug_vm_pgtable.c:1031
 debug_vm_pgtable+0x33c/0x38e mm/debug_vm_pgtable.c:1359
 do_one_initcall+0x257/0x800 init/main.c:1309
 do_initcall_level+0x13d/0x1ed init/main.c:1382
 do_initcalls+0x4b/0x8a init/main.c:1398
 kernel_init_freeable+0x401/0x5ab init/main.c:1637
 kernel_init+0x19/0x1b0 init/main.c:1525
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff888056b4ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888056b4ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888056b4f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888056b4f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888056b4f100: 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
2026/08/05 01:56 linux-6.1.y fb28aa725e05 d4abbeac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in sd_stopN
* Struck through repros no longer work on HEAD.