================================================================== BUG: KASAN: use-after-free in v4l2_fh_init+0x279/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 Read of size 8 at addr ffff8880316fc8b8 by task v4l_id/8745 CPU: 0 PID: 8745 Comm: v4l_id Not tainted 5.13.0-rc2-next-20210518-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+0x13e/0x1d6 lib/dump_stack.c:129 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:436 v4l2_fh_init+0x279/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 v4l2_fh_open+0x88/0xc0 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0x11c/0x570 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x21c/0x3f0 drivers/media/v4l2-core/v4l2-dev.c:429 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4b9/0x11c0 fs/open.c:826 do_open fs/namei.c:3361 [inline] path_openat+0x1c09/0x27d0 fs/namei.c:3494 do_filp_open+0x190/0x3d0 fs/namei.c:3521 do_sys_openat2+0x16d/0x420 fs/open.c:1196 do_sys_open fs/open.c:1212 [inline] __do_sys_open fs/open.c:1220 [inline] __se_sys_open fs/open.c:1216 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1216 do_syscall_64+0x31/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f74678c6840 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:00007fff387ef948 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007fff387efab8 RCX: 00007f74678c6840 RDX: 00007f74678b2ea0 RSI: 0000000000000000 RDI: 00007fff387f0f1d RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 000055bb14d828d0 R13: 00007fff387efab0 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the page: page:ffffea0000c5bf00 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x316fc flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffff88813fffb910 ffffea0000b63308 0000000000000000 raw: 0000000000000000 0000000000000002 00000000ffffff7f 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 0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), pid 8566, ts 115359279942, free_ts 115546435685 prep_new_page mm/page_alloc.c:2377 [inline] get_page_from_freelist+0x125c/0x2ed0 mm/page_alloc.c:4038 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5239 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272 kmalloc_order+0x34/0xf0 mm/slab_common.c:954 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:970 kmalloc_large include/linux/slab.h:519 [inline] kmalloc include/linux/slab.h:583 [inline] kzalloc include/linux/slab.h:720 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x67/0x3265 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x12f/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1126 request_module_async+0x5d/0x70 drivers/media/usb/em28xx/em28xx-cards.c:3410 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1305 [inline] __free_pages_ok+0x4cb/0xf30 mm/page_alloc.c:1586 kref_put.isra.0+0x6f/0xa0 include/linux/kref.h:65 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x238/0x3265 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x12f/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1126 request_module_async+0x5d/0x70 drivers/media/usb/em28xx/em28xx-cards.c:3410 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Memory state around the buggy address: ffff8880316fc780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880316fc800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880316fc880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880316fc900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880316fc980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================