================================================================== BUG: KASAN: use-after-free in v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] BUG: KASAN: use-after-free in v4l2_fh_open+0xc7/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 Read of size 8 at addr ffff888061ee0900 by task v4l_id/5121 CPU: 0 PID: 5121 Comm: v4l_id Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description+0x63/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:451 v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] v4l2_fh_open+0xc7/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0x15d/0xa10 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x228/0x360 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x54a/0x630 fs/char_dev.c:414 do_dentry_open+0x807/0xfb0 fs/open.c:826 do_open fs/namei.c:3608 [inline] path_openat+0x2705/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x4f0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1280 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f5441d419a4 Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffc5983e170 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffc5983e388 RCX: 00007f5441d419a4 RDX: 0000000000000000 RSI: 00007ffc5983ff1d RDI: 00000000ffffff9c RBP: 00007ffc5983ff1d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc5983e3a0 R14: 0000561df594c670 R15: 00007f544218aa80 The buggy address belongs to the page: page:ffffea000187b800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61ee0 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 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 0x102cc0(GFP_USER|__GFP_NOWARN), pid 4882, ts 118405441196, free_ts 118349090614 create_dummy_stack mm/page_owner.c:59 [inline] register_dummy_stack+0x86/0xe0 mm/page_owner.c:65 init_page_owner+0x30/0x730 mm/page_owner.c:83 kernel_init_freeable+0x420/0x5c0 init/main.c:1613 kernel_init+0x19/0x290 init/main.c:1506 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396 free_nonslab_page+0xe4/0x150 mm/slub.c:3535 kfree+0x1cf/0x270 mm/slub.c:4556 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2128 [inline] kref_put include/linux/kref.h:65 [inline] em28xx_v4l2_init+0x15d7/0x2d50 drivers/media/usb/em28xx/em28xx-video.c:2911 em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 process_scheduled_works kernel/workqueue.c:2373 [inline] worker_thread+0xd83/0x1280 kernel/workqueue.c:2462 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Memory state around the buggy address: ffff888061ee0800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888061ee0880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888061ee0900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888061ee0980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888061ee0a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================