================================================================== BUG: KASAN: use-after-free in vb2_mmap+0x668/0x6f0 drivers/media/common/videobuf2/videobuf2-core.c:2173 Read of size 8 at addr ffff8881d1bee900 by task syz-executor1/9386 CPU: 1 PID: 9386 Comm: syz-executor1 Not tainted 4.20.0-rc6+ #154 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x244/0x39d lib/dump_stack.c:113 print_address_description.cold.7+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.8+0x242/0x309 mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 vb2_mmap+0x668/0x6f0 drivers/media/common/videobuf2/videobuf2-core.c:2173 vb2_fop_mmap+0x4b/0x70 drivers/media/common/videobuf2/videobuf2-v4l2.c:1004 v4l2_mmap+0x153/0x200 drivers/media/v4l2-core/v4l2-dev.c:401 call_mmap include/linux/fs.h:1862 [inline] mmap_region+0xe85/0x1cd0 mm/mmap.c:1786 do_mmap+0xa22/0x1230 mm/mmap.c:1559 do_mmap_pgoff include/linux/mm.h:2328 [inline] vm_mmap_pgoff+0x213/0x2c0 mm/util.c:350 ksys_mmap_pgoff+0x4da/0x660 mm/mmap.c:1609 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x457669 Code: fd b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f37b9e0dc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000457669 RDX: fffffffffffffffe RSI: 0000000000004000 RDI: 0000000020ffa000 RBP: 000000000072bf00 R08: 0000000000000004 R09: 0000000000000000 R10: 0000000000000011 R11: 0000000000000246 R12: 00007f37b9e0e6d4 R13: 00000000004c2d3e R14: 00000000004d5078 R15: 00000000ffffffff Allocated by task 9386: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 __do_kmalloc mm/slab.c:3722 [inline] __kmalloc+0x15b/0x760 mm/slab.c:3731 kmalloc include/linux/slab.h:551 [inline] kzalloc include/linux/slab.h:741 [inline] __vb2_queue_alloc+0xf7/0xfa0 drivers/media/common/videobuf2/videobuf2-core.c:343 vb2_core_reqbufs+0x971/0x1040 drivers/media/common/videobuf2/videobuf2-core.c:735 __vb2_init_fileio+0x344/0xc90 drivers/media/common/videobuf2/videobuf2-core.c:2453 __vb2_perform_fileio+0xcfd/0x1210 drivers/media/common/videobuf2/videobuf2-core.c:2572 vb2_write+0x38/0x50 drivers/media/common/videobuf2/videobuf2-core.c:2711 vb2_fop_write+0x20a/0x400 drivers/media/common/videobuf2/videobuf2-v4l2.c:1046 v4l2_write+0x168/0x220 drivers/media/v4l2-core/v4l2-dev.c:334 __vfs_write+0x119/0x9f0 fs/read_write.c:485 vfs_write+0x1fc/0x560 fs/read_write.c:549 ksys_write+0x101/0x260 fs/read_write.c:598 __do_sys_write fs/read_write.c:610 [inline] __se_sys_write fs/read_write.c:607 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:607 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9379: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kfree+0xcf/0x230 mm/slab.c:3817 __vb2_queue_free+0x5e2/0xa30 drivers/media/common/videobuf2/videobuf2-core.c:526 vb2_core_reqbufs+0x2da/0x1040 drivers/media/common/videobuf2/videobuf2-core.c:694 __vb2_cleanup_fileio+0xf0/0x160 drivers/media/common/videobuf2/videobuf2-core.c:2530 vb2_core_queue_release+0x1e/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2254 vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:842 [inline] _vb2_fop_release+0x1d2/0x2b0 drivers/media/common/videobuf2/videobuf2-v4l2.c:1015 vb2_fop_release+0x77/0xc0 drivers/media/common/videobuf2/videobuf2-v4l2.c:1029 vivid_fop_release+0x18e/0x440 drivers/media/platform/vivid/vivid-core.c:474 v4l2_release+0x224/0x3a0 drivers/media/v4l2-core/v4l2-dev.c:456 __fput+0x385/0xa30 fs/file_table.c:278 ____fput+0x15/0x20 fs/file_table.c:309 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881d1bee900 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 0 bytes inside of 1024-byte region [ffff8881d1bee900, ffff8881d1beed00) The buggy address belongs to the page: page:ffffea000746fb80 count:1 mapcount:0 mapping:ffff8881da800ac0 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000010200(slab|head) raw: 02fffc0000010200 ffffea0006e83b88 ffffea0006f30c08 ffff8881da800ac0 raw: 0000000000000000 ffff8881d1bee000 0000000100000007 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d1bee800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d1bee880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881d1bee900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d1bee980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d1beea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================