================================================================== BUG: KASAN: use-after-free in v4l2_ctrl_lock include/media/v4l2-ctrls.h:454 [inline] BUG: KASAN: use-after-free in v4l2_ctrl_grab drivers/media/v4l2-core/v4l2-ctrls.c:2527 [inline] BUG: KASAN: use-after-free in v4l2_ctrl_grab+0x150/0x160 drivers/media/v4l2-core/v4l2-ctrls.c:2520 Read of size 8 at addr ffff8880a56f33e0 by task syz-executor.4/6219 CPU: 0 PID: 6219 Comm: syz-executor.4 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 kasan_report mm/kasan/report.c:412 [inline] __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433 v4l2_ctrl_lock include/media/v4l2-ctrls.h:454 [inline] v4l2_ctrl_grab drivers/media/v4l2-core/v4l2-ctrls.c:2527 [inline] v4l2_ctrl_grab+0x150/0x160 drivers/media/v4l2-core/v4l2-ctrls.c:2520 vicodec_stop_streaming+0x14a/0x190 drivers/media/platform/vicodec/vicodec-core.c:1166 __vb2_queue_cancel+0xae/0x790 drivers/media/common/videobuf2/videobuf2-core.c:1693 vb2_core_queue_release+0x22/0x70 drivers/media/common/videobuf2/videobuf2-core.c:2082 v4l2_m2m_ctx_release+0x26/0x30 drivers/media/v4l2-core/v4l2-mem2mem.c:928 vicodec_release+0xb6/0x110 drivers/media/platform/vicodec/vicodec-core.c:1304 v4l2_release+0xf4/0x190 drivers/media/v4l2-core/v4l2-dev.c:448 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 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+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f5067dcffab Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffc9377e380 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f5067dcffab RDX: 00007f50679925d8 RSI: ffffffffffffffff RDI: 0000000000000003 RBP: 00007f5067f3f980 R08: 0000000000000000 R09: 00007f5067992000 R10: 00007f50679925e0 R11: 0000000000000293 R12: 00000000000ae9dc R13: 00007ffc9377e480 R14: 00007f5067f3df80 R15: 0000000000000032 Allocated by task 6238: __do_kmalloc_node mm/slab.c:3689 [inline] __kmalloc_node+0x4c/0x70 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] kvzalloc include/linux/mm.h:585 [inline] v4l2_ctrl_new.part.0+0x22c/0x1400 drivers/media/v4l2-core/v4l2-ctrls.c:2176 v4l2_ctrl_new drivers/media/v4l2-core/v4l2-ctrls.c:2109 [inline] v4l2_ctrl_new_std+0x211/0x330 drivers/media/v4l2-core/v4l2-ctrls.c:2293 vicodec_open+0x1a6/0xad0 drivers/media/platform/vicodec/vicodec-core.c:1243 v4l2_open+0x1af/0x350 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x266/0x770 fs/char_dev.c:423 do_dentry_open+0x4aa/0x1160 fs/open.c:796 do_last fs/namei.c:3421 [inline] path_openat+0x793/0x2df0 fs/namei.c:3537 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 6219: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 kvfree+0x59/0x60 mm/util.c:452 v4l2_ctrl_handler_free drivers/media/v4l2-core/v4l2-ctrls.c:1930 [inline] v4l2_ctrl_handler_free+0x4a9/0x810 drivers/media/v4l2-core/v4l2-ctrls.c:1910 vicodec_release+0x63/0x110 drivers/media/platform/vicodec/vicodec-core.c:1302 v4l2_release+0xf4/0x190 drivers/media/v4l2-core/v4l2-dev.c:448 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 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+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880a56f33c0 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 32 bytes inside of 256-byte region [ffff8880a56f33c0, ffff8880a56f34c0) The buggy address belongs to the page: page:ffffea000295bcc0 count:1 mapcount:0 mapping:ffff88813bff07c0 index:0x0 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffffea00026b1548 ffffea000284b1c8 ffff88813bff07c0 raw: 0000000000000000 ffff8880a56f3000 000000010000000c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a56f3280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880a56f3300: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ffff8880a56f3380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880a56f3400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a56f3480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================