================================================================== BUG: KASAN: use-after-free in v4l2_ctrl_grab drivers/media/v4l2-core/v4l2-ctrls.c:2526 [inline] BUG: KASAN: use-after-free in v4l2_ctrl_grab+0x159/0x160 drivers/media/v4l2-core/v4l2-ctrls.c:2519 Read of size 8 at addr ffff8880504bb160 by task syz-executor.0/22952 CPU: 1 PID: 22952 Comm: syz-executor.0 Not tainted 4.19.81 #0 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+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 v4l2_ctrl_grab drivers/media/v4l2-core/v4l2-ctrls.c:2526 [inline] v4l2_ctrl_grab+0x159/0x160 drivers/media/v4l2-core/v4l2-ctrls.c:2519 vicodec_stop_streaming+0x158/0x1a0 drivers/media/platform/vicodec/vicodec-core.c:1166 __vb2_queue_cancel+0xb1/0x790 drivers/media/common/videobuf2/videobuf2-core.c:1682 vb2_core_queue_release+0x28/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2071 vb2_queue_release+0x16/0x20 drivers/media/common/videobuf2/videobuf2-v4l2.c:671 v4l2_m2m_ctx_release+0x2d/0x40 drivers/media/v4l2-core/v4l2-mem2mem.c:928 vicodec_release+0xc0/0x120 drivers/media/platform/vicodec/vicodec-core.c:1304 v4l2_release+0xf9/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:448 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x413ae1 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffd3625f5d0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000413ae1 RDX: 0000001b2dd20000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 0000000000000001 R08: 00000000f1b0d8d6 R09: 00000000f1b0d8da R10: 00007ffd3625f6b0 R11: 0000000000000293 R12: 000000000075bf20 R13: 00000000000e214f R14: 0000000000760688 R15: 000000000075bf2c Allocated by task 22953: save_stack+0x45/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531 __do_kmalloc_node mm/slab.c:3689 [inline] __kmalloc_node+0x51/0x80 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x68/0x100 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] kvzalloc include/linux/mm.h:585 [inline] v4l2_ctrl_new.part.0+0x214/0x1450 drivers/media/v4l2-core/v4l2-ctrls.c:2175 v4l2_ctrl_new drivers/media/v4l2-core/v4l2-ctrls.c:2108 [inline] v4l2_ctrl_new_std+0x22d/0x360 drivers/media/v4l2-core/v4l2-ctrls.c:2292 vicodec_open+0x1a8/0xb30 drivers/media/platform/vicodec/vicodec-core.c:1243 v4l2_open+0x1b2/0x360 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x245/0x6b0 fs/char_dev.c:423 do_dentry_open+0x4c3/0x1210 fs/open.c:796 vfs_open+0xa0/0xd0 fs/open.c:905 do_last fs/namei.c:3418 [inline] path_openat+0x10d7/0x45e0 fs/namei.c:3534 do_filp_open+0x1a1/0x280 fs/namei.c:3564 do_sys_open+0x3fe/0x550 fs/open.c:1088 __do_sys_openat fs/open.c:1115 [inline] __se_sys_openat fs/open.c:1109 [inline] __x64_sys_openat+0x9d/0x100 fs/open.c:1109 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 22952: save_stack+0x45/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:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 kvfree+0x61/0x70 mm/util.c:452 v4l2_ctrl_handler_free drivers/media/v4l2-core/v4l2-ctrls.c:1929 [inline] v4l2_ctrl_handler_free+0x4a8/0x7e0 drivers/media/v4l2-core/v4l2-ctrls.c:1909 vicodec_release+0x6b/0x120 drivers/media/platform/vicodec/vicodec-core.c:1302 v4l2_release+0xf9/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:448 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880504bb140 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 32 bytes inside of 256-byte region [ffff8880504bb140, ffff8880504bb240) The buggy address belongs to the page: page:ffffea0001412ec0 count:1 mapcount:0 mapping:ffff88812c3f07c0 index:0x0 flags: 0x1fffc0000000100(slab) raw: 01fffc0000000100 ffffea0001d6eb08 ffffea00026b2588 ffff88812c3f07c0 raw: 0000000000000000 ffff8880504bb000 000000010000000c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880504bb000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880504bb080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880504bb100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880504bb180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880504bb200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================