================================================================== BUG: KASAN: use-after-free in vb2_mmap+0x668/0x6f0 drivers/media/common/videobuf2/videobuf2-core.c:2173 Read of size 8 at addr ffff888189de9200 by task syz-executor1/12609 CPU: 0 PID: 12609 Comm: syz-executor1 Not tainted 4.20.0-rc6+ #276 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_pgoff mm/mmap.c:1620 [inline] __se_sys_mmap_pgoff mm/mmap.c:1616 [inline] __ia32_sys_mmap_pgoff+0xdd/0x1a0 mm/mmap.c:1616 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7fe3a29 Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 14 24 c3 8b 3c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000f5fdf0cc EFLAGS: 00000296 ORIG_RAX: 00000000000000c0 RAX: ffffffffffffffda RBX: 0000000020ffe000 RCX: 0000000000002000 RDX: 00000000fffffffd RSI: 0000000000000011 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 12598: 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_create_bufs+0x401/0x8c0 drivers/media/common/videobuf2/videobuf2-core.c:834 vb2_create_bufs+0x4b6/0x8f0 drivers/media/common/videobuf2/videobuf2-v4l2.c:721 vb2_ioctl_create_bufs+0x327/0x4a0 drivers/media/common/videobuf2/videobuf2-v4l2.c:921 v4l_create_bufs+0x152/0x230 drivers/media/v4l2-core/v4l2-ioctl.c:1927 __video_do_ioctl+0x8b1/0x1050 drivers/media/v4l2-core/v4l2-ioctl.c:2853 video_usercopy+0x5c1/0x1760 drivers/media/v4l2-core/v4l2-ioctl.c:3035 video_ioctl2+0x2c/0x33 drivers/media/v4l2-core/v4l2-ioctl.c:3079 v4l2_ioctl+0x154/0x1b0 drivers/media/v4l2-core/v4l2-dev.c:364 native_ioctl drivers/media/v4l2-core/v4l2-compat-ioctl32.c:116 [inline] do_video_ioctl drivers/media/v4l2-core/v4l2-compat-ioctl32.c:1354 [inline] v4l2_compat_ioctl32+0x3e5/0x5cf0 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:1461 __do_compat_sys_ioctl fs/compat_ioctl.c:1052 [inline] __se_compat_sys_ioctl fs/compat_ioctl.c:998 [inline] __ia32_compat_sys_ioctl+0x20e/0x630 fs/compat_ioctl.c:998 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 Freed by task 12598: 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_queue_release+0x62/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2257 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 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x1ad6/0x26d0 kernel/exit.c:867 do_group_exit+0x177/0x440 kernel/exit.c:970 get_signal+0x8b0/0x1980 kernel/signal.c:2517 do_signal+0x9c/0x21c0 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x2e5/0x380 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_32_irqs_on arch/x86/entry/common.c:341 [inline] do_fast_syscall_32+0xcd5/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 The buggy address belongs to the object at ffff888189de9200 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 0 bytes inside of 1024-byte region [ffff888189de9200, ffff888189de9600) The buggy address belongs to the page: page:ffffea0006277a00 count:1 mapcount:0 mapping:ffff8881da800ac0 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000010200(slab|head) raw: 02fffc0000010200 ffffea0006dd2608 ffffea000625af88 ffff8881da800ac0 raw: 0000000000000000 ffff888189de8000 0000000100000007 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888189de9100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888189de9180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888189de9200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888189de9280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888189de9300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================