================================================================== BUG: KASAN: use-after-free in mcp2221_raw_event+0x1070/0x10a0 drivers/hid/hid-mcp2221.c:948 Read of size 1 at addr ffff888131a53fff by task syz.3.3080/17134 CPU: 0 UID: 0 PID: 17134 Comm: syz.3.3080 Not tainted syzkaller #0 PREEMPT(voluntary) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 mcp2221_raw_event+0x1070/0x10a0 drivers/hid/hid-mcp2221.c:948 __hid_input_report.constprop.0+0x314/0x450 drivers/hid/hid-core.c:2139 hid_irq_in+0x35e/0x870 drivers/hid/usbhid/hid-core.c:286 __usb_hcd_giveback_urb+0x38b/0x610 drivers/usb/core/hcd.c:1661 usb_hcd_giveback_urb+0x39b/0x450 drivers/usb/core/hcd.c:1745 dummy_timer+0x1809/0x3a00 drivers/usb/gadget/udc/dummy_hcd.c:1995 __run_hrtimer kernel/time/hrtimer.c:1777 [inline] __hrtimer_run_queues+0x202/0xad0 kernel/time/hrtimer.c:1841 hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1858 handle_softirqs+0x208/0x8d0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0xfa/0x160 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1052 [inline] sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1052 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 RIP: 0010:finish_task_switch.isra.0+0x1e9/0x9e0 kernel/sched/core.c:5193 Code: 0f 85 5f 07 00 00 8b 0d 79 c4 51 09 85 c9 0f 85 b9 02 00 00 48 89 df e8 c5 dc f7 05 e8 40 10 37 00 fb 65 48 8b 1d 1f cc 48 0b <48> 8d bb 50 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc9001547fb00 EFLAGS: 00000202 RAX: 000000000000033b RBX: ffff888111ca5700 RCX: ffffffff8186432f RDX: 0000000000000000 RSI: ffffffff88c88a08 RDI: ffffffff878979c0 RBP: ffffc9001547fb40 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff8aa0ebd7 R11: 0000000000000001 R12: ffff888111ca0000 R13: 0000000000000000 R14: ffff8881f5838918 R15: ffff8881f5839418 context_switch kernel/sched/core.c:5328 [inline] __schedule+0x1304/0x3b80 kernel/sched/core.c:6929 preempt_schedule_common+0x44/0xc0 kernel/sched/core.c:7113 __cond_resched+0x22/0x30 kernel/sched/core.c:7458 might_resched include/linux/kernel.h:61 [inline] down_write+0x73/0x200 kernel/locking/rwsem.c:1589 kernfs_remove_by_name_ns+0x3d/0x110 fs/kernfs/dir.c:1712 sysfs_remove_file include/linux/sysfs.h:770 [inline] driver_remove_file drivers/base/driver.c:201 [inline] driver_remove_file+0x4a/0x60 drivers/base/driver.c:197 remove_bind_files drivers/base/bus.c:605 [inline] bus_remove_driver+0x224/0x2c0 drivers/base/bus.c:743 driver_unregister+0x76/0xb0 drivers/base/driver.c:277 usb_gadget_register_driver_owner+0x20f/0x330 drivers/usb/gadget/udc/core.c:1726 raw_ioctl_run drivers/usb/gadget/legacy/raw_gadget.c:595 [inline] raw_ioctl+0x17d0/0x2c30 drivers/usb/gadget/legacy/raw_gadget.c:1304 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4d0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f7c3ffeebcb Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00 RSP: 002b:00007f7c3ea2bf10 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f7c3ffeebcb RDX: 0000000000000000 RSI: 0000000000005501 RDI: 0000000000000005 RBP: 00007f7c3ea2cfe0 R08: 0000000000000000 R09: 00332e6364755f79 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f7c3ea2bfb0 R14: 0000200000000000 R15: 00007f7c403713f0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x131a53 flags: 0x200000000000000(node=0|zone=2) page_type: f0(buddy) raw: 0200000000000000 ffffea0004c6ab88 ffffea0004c61688 0000000000000000 raw: 0000000000000000 0000000000000000 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_ZERO|__GFP_NOWARN), pid 16382, tgid 16382 (syz-executor), ts 1590296667998, free_ts 1650709774162 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x1003/0x2dc0 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x259/0x21f0 mm/page_alloc.c:5183 alloc_pages_mpol+0xe4/0x410 mm/mempolicy.c:2416 alloc_frozen_pages_noprof mm/mempolicy.c:2487 [inline] alloc_pages_noprof+0x131/0x390 mm/mempolicy.c:2507 vm_area_alloc_pages mm/vmalloc.c:3647 [inline] __vmalloc_area_node mm/vmalloc.c:3724 [inline] __vmalloc_node_range_noprof+0x6f8/0x1480 mm/vmalloc.c:3897 vmalloc_user_noprof+0x9e/0xe0 mm/vmalloc.c:4050 kcov_ioctl+0x4c/0x730 kernel/kcov.c:716 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4d0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 16394 tgid 16394 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x78f/0x1000 mm/page_alloc.c:2906 vfree+0x1fd/0xb50 mm/vmalloc.c:3440 kcov_put kernel/kcov.c:439 [inline] kcov_put kernel/kcov.c:435 [inline] kcov_close+0x34/0x60 kernel/kcov.c:535 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x86f/0x2bf0 kernel/exit.c:966 do_group_exit+0xd3/0x2a0 kernel/exit.c:1107 get_signal+0x2671/0x26d0 kernel/signal.c:3034 arch_do_signal_or_restart+0x8f/0x7c0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop+0x76/0xe0 kernel/entry/common.c:40 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x40f/0x4d0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888131a53e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888131a53f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888131a53f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888131a54000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888131a54080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 0f 85 5f 07 00 00 jne 0x765 6: 8b 0d 79 c4 51 09 mov 0x951c479(%rip),%ecx # 0x951c485 c: 85 c9 test %ecx,%ecx e: 0f 85 b9 02 00 00 jne 0x2cd 14: 48 89 df mov %rbx,%rdi 17: e8 c5 dc f7 05 call 0x5f7dce1 1c: e8 40 10 37 00 call 0x371061 21: fb sti 22: 65 48 8b 1d 1f cc 48 mov %gs:0xb48cc1f(%rip),%rbx # 0xb48cc49 29: 0b * 2a: 48 8d bb 50 15 00 00 lea 0x1550(%rbx),%rdi <-- trapping instruction 31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 38: fc ff df 3b: 48 89 fa mov %rdi,%rdx 3e: 48 rex.W 3f: c1 .byte 0xc1