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: BUG: sleeping function called from invalid context in lock_sock_nested run #1: crashed: BUG: sleeping function called from invalid context in lock_sock_nested 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: KASAN: use-after-free Read in v4l2_fh_init run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: KASAN: use-after-free Read in v4l2_fh_init run #9: crashed: KASAN: use-after-free Read in v4l2_fh_init 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 f1baf68e1383f6ed93eb9cff2866d46562607a43 testing commit f1baf68e1383f6ed93eb9cff2866d46562607a43 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: d4708544c2d07b349ee84d86a9378656561ad7e992ffa0e8ba5ae55d269142ac all runs: crashed: KASAN: use-after-free Read in v4l2_fh_init revisions tested: 2, total time: 19m56.210775353s (build: 12m39.118275699s, test: 6m41.053508813s) the crash still happens on HEAD commit msg: Merge tag 'net-5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 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 ffff888061e708c0 by task v4l_id/4374 CPU: 0 PID: 4374 Comm: v4l_id Not tainted 5.17.0-rc3-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/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 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:824 do_open fs/namei.c:3476 [inline] path_openat+0x9ea/0x2390 fs/namei.c:3609 do_filp_open+0x199/0x3d0 fs/namei.c:3636 do_sys_openat2+0x11e/0x400 fs/open.c:1214 do_sys_open fs/open.c:1230 [inline] __do_sys_openat fs/open.c:1246 [inline] __se_sys_openat fs/open.c:1241 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1241 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:0x7fb2f0512697 Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f RSP: 002b:00007ffc05731770 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fb2f0953c40 RCX: 00007fb2f0512697 RDX: 0000000000000000 RSI: 00007ffc05732f1f RDI: 00000000ffffff9c RBP: 00007ffc05732f1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 0: (stack is not available) The buggy address belongs to the object at ffff888061e70800 which belongs to the cache kmalloc-cg-512 of size 512 The buggy address is located 192 bytes inside of 512-byte region [ffff888061e70800, ffff888061e70a00) The buggy address belongs to the page: page:ffffea0001879c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61e70 head:ffffea0001879c00 order:2 compound_mapcount:0 compound_pincount:0 memcg:ffff888074ed1001 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88800fc42dc0 raw: 0000000000000000 0000000080100010 00000001ffffffff ffff888074ed1001 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 2992, ts 83731014312, free_ts 83692308882 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa6f/0x2f10 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28a/0x3b0 mm/slub.c:2004 ___slab_alloc+0x87e/0xe80 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] __kmalloc_node_track_caller+0x2cb/0x360 mm/slub.c:4957 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x8a/0x270 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1158 [inline] alloc_skb_with_frags+0x73/0x550 net/core/skbuff.c:5956 sock_alloc_send_pskb+0x636/0x7c0 net/core/sock.c:2586 unix_dgram_sendmsg+0x35a/0x16f0 net/unix/af_unix.c:1896 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:725 __sys_sendto+0x1a4/0x270 net/socket.c:2040 __do_sys_sendto net/socket.c:2052 [inline] __se_sys_sendto net/socket.c:2048 [inline] __x64_sys_sendto+0xd8/0x1b0 net/socket.c:2048 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x21f/0x2d3f drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x879/0x1410 kernel/workqueue.c:2307 process_scheduled_works kernel/workqueue.c:2370 [inline] worker_thread+0x6ef/0xf60 kernel/workqueue.c:2459 kthread+0x299/0x340 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff888061e70780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888061e70800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888061e70880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888061e70900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888061e70980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================