KASAN: use-after-free Read in __video_do_ioctl

Status: upstream: reported on 2026/09/12 06:11
Reported-by: syzbot+a826c34c0a37c0abb8b5@syzkaller.appspotmail.com
First crash: 8d02h, last: 8d02h
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __video_do_ioctl media usb input 19 syz 63 2615d 2715d 0/29 closed as dup on 2019/08/13 12:28
upstream KASAN: slab-use-after-free Read in __video_do_ioctl media 19 3 250d 400d 29/29 fixed on 2026/05/21 07:50
upstream KASAN: slab-use-after-free Read in __video_do_ioctl (2) media prio:high actionable 19 2 29d 25d 0/29 upstream: reported on 2026/08/26 01:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
BUG: KASAN: use-after-free in video_is_registered include/media/v4l2-dev.h:540 [inline]
BUG: KASAN: use-after-free in __video_do_ioctl+0x55d/0xe40 drivers/media/v4l2-core/v4l2-ioctl.c:2951
Read of size 8 at addr ffff88807b380820 by task v4l_id/20015

CPU: 0 PID: 20015 Comm: v4l_id 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/0x250 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
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x235/0x290 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
 video_is_registered include/media/v4l2-dev.h:540 [inline]
 __video_do_ioctl+0x55d/0xe40 drivers/media/v4l2-core/v4l2-ioctl.c:2951
 video_usercopy+0x930/0xf10 drivers/media/v4l2-core/v4l2-ioctl.c:3325
 v4l2_ioctl+0x183/0x1d0 drivers/media/v4l2-core/v4l2-dev.c:364
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 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
RIP: 0033:0x7fe1f2568378
Code: 00 00 48 8d 44 24 08 48 89 54 24 e0 48 89 44 24 c0 48 8d 44 24 d0 48 89 44 24 c8 b8 10 00 00 00 c7 44 24 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 07 89 d0 c3 0f 1f 40 00 48 8b 15 49 3a 0d
RSP: 002b:00007fffcb6389a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fe1f2568378
RDX: 00007fffcb6389b0 RSI: 0000000080685600 RDI: 0000000000000003
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fffcb638b60 R14: 00007fe1f2c80000 R15: 0000563439ca44d8
 </TASK>

Allocated by task 4230:
 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+0xaf/0xe0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:607 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 sur40_probe+0x164/0xf00 drivers/input/touchscreen/sur40.c:675
 usb_probe_interface+0x5be/0xae0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x276/0xc70 drivers/base/dd.c:595
 __driver_probe_device+0x1f5/0x390 drivers/base/dd.c:775
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:805
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:927
 bus_for_each_drv+0x184/0x210 drivers/base/bus.c:429
 __device_attach+0x2a7/0x480 drivers/base/dd.c:999
 bus_probe_device+0xba/0x1d0 drivers/base/bus.c:489
 device_add+0xbcf/0x1050 drivers/base/core.c:3427
 usb_set_configuration+0x19d5/0x2030 drivers/usb/core/message.c:2223
 usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x126/0x250 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x276/0xc70 drivers/base/dd.c:595
 __driver_probe_device+0x1f5/0x390 drivers/base/dd.c:775
 driver_probe_device+0x4f/0x420 drivers/base/dd.c:805
 __device_attach_driver+0x2b0/0x500 drivers/base/dd.c:927
 bus_for_each_drv+0x184/0x210 drivers/base/bus.c:429
 __device_attach+0x2a7/0x480 drivers/base/dd.c:999
 bus_probe_device+0xba/0x1d0 drivers/base/bus.c:489
 device_add+0xbcf/0x1050 drivers/base/core.c:3427
 usb_new_device+0x9f6/0x15d0 drivers/usb/core/hub.c:2637
 hub_port_connect drivers/usb/core/hub.c:5502 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5642 [inline]
 port_event drivers/usb/core/hub.c:5804 [inline]
 hub_event+0x2b8d/0x5260 drivers/usb/core/hub.c:5886
 process_one_work+0x867/0xff0 kernel/workqueue.c:2310
 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457
 kthread+0x42e/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 4230:
 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+0xec/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 sur40_disconnect+0xab/0x110 drivers/input/touchscreen/sur40.c:835
 usb_unbind_interface+0x203/0x870 drivers/usb/core/driver.c:458
 __device_release_driver drivers/base/dd.c:1249 [inline]
 device_release_driver_internal+0x487/0x710 drivers/base/dd.c:1282
 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531
 device_del+0x63f/0xa80 drivers/base/core.c:3615
 usb_disable_device+0x3e7/0x8a0 drivers/usb/core/message.c:1472
 usb_disconnect+0x33c/0x8a0 drivers/usb/core/hub.c:2292
 hub_port_connect drivers/usb/core/hub.c:5346 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5642 [inline]
 port_event drivers/usb/core/hub.c:5804 [inline]
 hub_event+0x1d64/0x5260 drivers/usb/core/hub.c:5886
 process_one_work+0x867/0xff0 kernel/workqueue.c:2310
 process_scheduled_works kernel/workqueue.c:2373 [inline]
 worker_thread+0xd93/0x12a0 kernel/workqueue.c:2459
 kthread+0x42e/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 ffff88807b380000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2080 bytes inside of
 4096-byte region [ffff88807b380000, ffff88807b381000)
The buggy address belongs to the page:
page:ffffea0001ece000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b380
head:ffffea0001ece000 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016c42140
raw: 0000000000000000 0000000000040004 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 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4353, ts 819536552868, free_ts 819318885106
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192
 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
 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+0x807/0xdd0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 slab_alloc mm/slub.c:3233 [inline]
 __kmalloc+0x11d/0x340 mm/slub.c:4408
 kmalloc include/linux/slab.h:612 [inline]
 tomoyo_realpath_from_path+0xed/0x5e0 security/tomoyo/realpath.c:254
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x23f/0x5d0 security/tomoyo/file.c:822
 security_inode_getattr+0xcf/0x120 security/security.c:1398
 vfs_getattr+0x26/0x3a0 fs/stat.c:157
 vfs_statx+0x146/0x4c0 fs/stat.c:225
 vfs_fstatat fs/stat.c:243 [inline]
 __do_sys_newfstatat fs/stat.c:411 [inline]
 __se_sys_newfstatat fs/stat.c:405 [inline]
 __x64_sys_newfstatat+0x15f/0x200 fs/stat.c:405
 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+0x8f/0x2a0 mm/page_alloc.c:3396
 free_slab mm/slub.c:2020 [inline]
 discard_slab mm/slub.c:2026 [inline]
 __unfreeze_partials+0x188/0x1e0 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/0xc0 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]
 slab_alloc mm/slub.c:3233 [inline]
 kmem_cache_alloc+0x15d/0x280 mm/slub.c:3238
 ptlock_alloc+0x1c/0x60 mm/memory.c:5556
 ptlock_init include/linux/mm.h:2241 [inline]
 pgtable_pte_page_ctor include/linux/mm.h:2268 [inline]
 __pte_alloc_one include/asm-generic/pgalloc.h:66 [inline]
 pte_alloc_one+0xc0/0x310 arch/x86/mm/pgtable.c:33
 do_fault_around mm/memory.c:4237 [inline]
 do_read_fault mm/memory.c:4258 [inline]
 do_fault mm/memory.c:4392 [inline]
 handle_pte_fault mm/memory.c:4650 [inline]
 __handle_mm_fault mm/memory.c:4785 [inline]
 handle_mm_fault+0x2553/0x4440 mm/memory.c:4883
 faultin_page mm/gup.c:976 [inline]
 __get_user_pages+0x952/0x11e0 mm/gup.c:1197
 populate_vma_page_range+0x213/0x290 mm/gup.c:1529
 __mm_populate+0x275/0x3b0 mm/gup.c:1638
 mm_populate include/linux/mm.h:2646 [inline]
 vm_mmap_pgoff+0x212/0x2d0 mm/util.c:556

Memory state around the buggy address:
 ffff88807b380700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b380780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807b380800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff88807b380880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b380900: 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/09/12 06:10 linux-5.15.y 0996e0926f6b 70a60e12 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in __video_do_ioctl
* Struck through repros no longer work on HEAD.