================================================================== 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 ffff8880630e88c0 by task v4l_id/4461 CPU: 1 PID: 4461 Comm: v4l_id Not tainted 5.18.0-rc6-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:0x7f9a29325697 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:00007ffc1269b2d0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000559580fe7c40 RCX: 00007f9a29325697 RDX: 0000000000000000 RSI: 00007ffc1269cf1f RDI: 00000000ffffff9c RBP: 00007ffc1269cf1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page:ffffea00018c3a00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x630e8 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea00018cb508 ffff8880b9e40330 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x140dc0(GFP_USER|__GFP_COMP|__GFP_ZERO), pid 14, tgid 14 (kworker/0:1), ts 98181471262, free_ts 98410356841 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 kmalloc_order+0x34/0xf0 mm/slab_common.c:953 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:969 kmalloc_large include/linux/slab.h:510 [inline] kmalloc include/linux/slab.h:574 [inline] kzalloc include/linux/slab.h:714 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x65/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 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: ffff8880630e8780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880630e8800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880630e8880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880630e8900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880630e8980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================