================================================================== 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 ffff8880610648c0 by task v4l_id/4396 CPU: 1 PID: 4396 Comm: v4l_id Not tainted 5.18.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:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 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+0x414/0xfd0 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x9cf/0x2360 fs/namei.c:3609 do_filp_open+0x199/0x3d0 fs/namei.c:3636 do_sys_openat2+0x11e/0x3f0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ff5f5525697 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:00007fffd2164820 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000560e814f9c40 RCX: 00007ff5f5525697 RDX: 0000000000000000 RSI: 00007fffd2165f1f RDI: 00000000ffffff9c RBP: 00007fffd2165f1f 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 ffff888061064800 which belongs to the cache kmalloc-cg-512 of size 512 The buggy address is located 192 bytes inside of 512-byte region [ffff888061064800, ffff888061064a00) The buggy address belongs to the physical page: page:ffffea0001841900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61064 head:ffffea0001841900 order:2 compound_mapcount:0 compound_pincount:0 memcg:ffff8880787deb01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88800fc42dc0 raw: 0000000000000000 0000000080100010 00000001ffffffff ffff8880787deb01 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 2989, tgid 2989 (klogd), ts 79712184386, free_ts 79689423138 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0x178d/0x3dc0 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8e1/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] __kmalloc_node_track_caller+0x2cb/0x360 mm/slub.c:4947 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x8a/0x270 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1300 [inline] alloc_skb_with_frags+0x72/0x700 net/core/skbuff.c:5995 sock_alloc_send_pskb+0x636/0x7c0 net/core/sock.c:2600 unix_dgram_sendmsg+0x35a/0x1770 net/unix/af_unix.c:1896 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:725 __sys_sendto+0x19e/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/0x80 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:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x21f/0x2d3e drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 worker_thread+0x598/0xec0 kernel/workqueue.c:2436 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Memory state around the buggy address: ffff888061064780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888061064800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888061064880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888061064900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888061064980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================