bisecting fixing commit since e4e453434a199cdfa1e1e5cc723d8736f522354a building syzkaller on 1ba81399e2d03b53a7e631c4ab05f25af1fb1911 testing commit e4e453434a199cdfa1e1e5cc723d8736f522354a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b406e49db67074853b023b3ea50338bfaa091ea93478ee3cdf1a2bb6f1eec48e run #0: crashed: KASAN: use-after-free Read in v4l2_fh_init run #1: crashed: KASAN: use-after-free Read in v4l2_fh_init run #2: crashed: KASAN: use-after-free Read in v4l2_fh_init run #3: crashed: KASAN: use-after-free Read in v4l2_fh_init run #4: crashed: KASAN: use-after-free Read in v4l2_fh_init run #5: crashed: KASAN: use-after-free Read in v4l2_fh_init run #6: crashed: BUG: sleeping function called from invalid context in lock_sock_nested run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: BUG: sleeping function called from invalid context in lock_sock_nested run #9: crashed: BUG: sleeping function called from invalid context in lock_sock_nested run #10: crashed: KASAN: use-after-free Read in v4l2_fh_init run #11: crashed: KASAN: use-after-free Read in v4l2_fh_init run #12: crashed: KASAN: use-after-free Read in v4l2_fh_init run #13: crashed: KASAN: use-after-free Read in v4l2_fh_init run #14: crashed: KASAN: use-after-free Read in v4l2_fh_init run #15: crashed: KASAN: use-after-free Read in v4l2_fh_init run #16: crashed: KASAN: use-after-free Read in v4l2_fh_init run #17: crashed: KASAN: use-after-free Read in v4l2_fh_init run #18: crashed: KASAN: use-after-free Read in v4l2_fh_init run #19: crashed: KASAN: use-after-free Read in v4l2_fh_init testing current HEAD 66f4beaa6c1d28161f534471484b2daa2de1dce0 testing commit 66f4beaa6c1d28161f534471484b2daa2de1dce0 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 21920cb5444f942181a74f817cca8b8b35faab1ec0caed7e43e4e4635575ec12 all runs: crashed: KASAN: use-after-free Read in v4l2_fh_init revisions tested: 2, total time: 21m42.203969242s (build: 12m37.423582041s, test: 8m12.081072201s) the crash still happens on HEAD commit msg: Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 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 ffff88805f1cc900 by task v4l_id/13704 CPU: 0 PID: 13704 Comm: v4l_id Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 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:427 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x429/0x1040 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x9ea/0x2250 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 do_sys_openat2+0x11e/0x400 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_open fs/open.c:1236 [inline] __se_sys_open fs/open.c:1232 [inline] __x64_sys_open+0xfd/0x1a0 fs/open.c:1232 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f054f14a840 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:00007ffcba2986a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007ffcba298818 RCX: 00007f054f14a840 RDX: 00007f054f136ea0 RSI: 0000000000000000 RDI: 00007ffcba298f1c RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 0000557068db98d0 R13: 00007ffcba298810 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the page: page:ffffea00017c7300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5f1cc head:ffffea00017c7300 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010000(head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), pid 9188, ts 141695347363, free_ts 141792896698 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa6f/0x2f10 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 kmalloc_order+0x34/0xf0 mm/slab_common.c:949 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:965 kmalloc_large include/linux/slab.h:519 [inline] kmalloc include/linux/slab.h:583 [inline] kzalloc include/linux/slab.h:724 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x65/0x2d35 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 worker_thread+0x598/0x1040 kernel/workqueue.c:2445 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x21f/0x2d35 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 worker_thread+0x598/0x1040 kernel/workqueue.c:2445 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88805f1cc800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88805f1cc880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88805f1cc900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88805f1cc980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88805f1cca00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================