bisecting fixing commit since f40ddce88593482919761f74910f42f4b84c004b building syzkaller on 98682e5e2aefc9aad61354f4f3ac93be96002a2a testing commit f40ddce88593482919761f74910f42f4b84c004b with gcc (GCC) 10.2.1 20210217 kernel signature: 31380acbde5081ebcc03b8b1cc92921ed4a81eb7f97a79d4e8ce6ac16d2b8953 all runs: crashed: KASAN: use-after-free Read in v4l2_fh_init testing current HEAD 45af60e7ced07ae3def41368c3d260dbf496fbce testing commit 45af60e7ced07ae3def41368c3d260dbf496fbce with gcc (GCC) 10.2.1 20210217 kernel signature: 74f827c5a6714a5c9d83fca03d1355c96861c85d87d18096de566d6cdd0e3aeb all runs: crashed: KASAN: use-after-free Read in v4l2_fh_init revisions tested: 2, total time: 23m5.41727157s (build: 14m57.06216228s, test: 7m18.632170536s) the crash still happens on HEAD commit msg: Merge tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux crash: KASAN: use-after-free Read in v4l2_fh_init ================================================================== BUG: KASAN: use-after-free in v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 Read of size 8 at addr ffff8880462208b8 by task v4l_id/10578 CPU: 0 PID: 10578 Comm: v4l_id Not tainted 5.13.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x93/0xc2 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436 v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 v4l2_fh_open+0x78/0xb0 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0xd6/0x430 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x1e3/0x370 drivers/media/v4l2-core/v4l2-dev.c:429 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x42a/0xfb0 fs/open.c:826 do_open fs/namei.c:3361 [inline] path_openat+0x9ee/0x22b0 fs/namei.c:3494 do_filp_open+0x17f/0x3a0 fs/namei.c:3521 do_sys_openat2+0x11e/0x360 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_open fs/open.c:1211 [inline] __se_sys_open fs/open.c:1207 [inline] __x64_sys_open+0xfd/0x1a0 fs/open.c:1207 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f53d272a840 Code: 73 01 c3 48 8b 0d 68 77 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 89 bb 20 00 00 75 10 b8 02 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 1e f6 ff ff 48 89 04 24 RSP: 002b:00007ffc5e9292f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007ffc5e929468 RCX: 00007f53d272a840 RDX: 00007f53d2716ea0 RSI: 0000000000000000 RDI: 00007ffc5e929f1f RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 00005562e507b8d0 R13: 00007ffc5e929460 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10249: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc mm/kasan/common.c:507 [inline] __kasan_kmalloc+0x7a/0x90 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:246 [inline] kmem_cache_alloc_trace+0x1ea/0x440 mm/slab.c:3575 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:686 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d6d drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x84c/0x13b0 kernel/workqueue.c:2275 process_scheduled_works kernel/workqueue.c:2337 [inline] worker_thread+0x6ea/0xf80 kernel/workqueue.c:2426 kthread+0x36f/0x450 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Freed by task 10249: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xb2/0xe0 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0xeb/0x260 mm/slab.c:3803 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x24a/0x2d6d drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x84c/0x13b0 kernel/workqueue.c:2275 process_scheduled_works kernel/workqueue.c:2337 [inline] worker_thread+0x6ea/0xf80 kernel/workqueue.c:2426 kthread+0x36f/0x450 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 The buggy address belongs to the object at ffff888046220000 which belongs to the cache kmalloc-16k of size 16384 The buggy address is located 2232 bytes inside of 16384-byte region [ffff888046220000, ffff888046224000) The buggy address belongs to the page: page:00000000e67d159e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46220 head:00000000e67d159e order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001186208 ffffea00012b7008 ffff88800f040b00 raw: 0000000000000000 ffff888046220000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888046220780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888046220800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888046220880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888046220900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888046220980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================