==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0x1070/0x10a0 drivers/hid/hid-mcp2221.c:948
Read of size 1 at addr ffff888127d7ffff by task syz.1.6130/31083
CPU: 0 UID: 0 PID: 31083 Comm: syz.1.6130 Not tainted syzkaller #0 PREEMPT(voluntary)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/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/0x470 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/0x3ad0 drivers/usb/gadget/udc/dummy_hcd.c:1995
__run_hrtimer kernel/time/hrtimer.c:1777 [inline]
__hrtimer_run_queues+0x202/0xc40 kernel/time/hrtimer.c:1841
hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1858
handle_softirqs+0x208/0x940 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:1056 [inline]
sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1056
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697
RIP: 0010:stack_trace_consume_entry+0x73/0x170 kernel/stacktrace.c:89
Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e ad 00 00 00 31 c0 3b 6b 08 0f 83 81 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 0c <48> 89 fa 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0
RSP: 0018:ffffc9000d3b79d0 EFLAGS: 00000283
RAX: dffffc0000000000 RBX: ffffc9000d3b7ab0 RCX: ffffc9000d3b7944
RDX: 1ffff92001a76f57 RSI: ffffffff81e18464 RDI: ffffc9000d3b7abc
RBP: 0000000000000001 R08: 0000000000000001 R09: 00000000ffffffff
R10: 0000000000000002 R11: 000000000000e183 R12: ffffffff816b1980
R13: ffffc9000d3b7ab0 R14: 0000000000000000 R15: ffff888112771d40
arch_stack_walk+0x88/0x100 arch/x86/kernel/stacktrace.c:27
stack_trace_save+0x8e/0xc0 kernel/stacktrace.c:122
kasan_save_stack+0x33/0x60 mm/kasan/common.c:56
kasan_save_track+0x14/0x30 mm/kasan/common.c:77
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:252 [inline]
__kasan_slab_free+0x43/0x70 mm/kasan/common.c:284
kasan_slab_free include/linux/kasan.h:234 [inline]
slab_free_hook mm/slub.c:2540 [inline]
slab_free mm/slub.c:6668 [inline]
kfree+0x2c8/0x680 mm/slub.c:6876
raw_ioctl_ep_write drivers/usb/gadget/legacy/raw_gadget.c:1154 [inline]
raw_ioctl+0xab6/0x2e60 drivers/usb/gadget/legacy/raw_gadget.c:1325
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/0x570 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb754b4f34b
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:00007fb7535adf70 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fb754b4f34b
RDX: 00007fb7535adff0 RSI: 0000000040085507 RDI: 0000000000000003
RBP: 0000000000000003 R08: 00007fb754ed0320 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 0000200000000040
R13: 0000000000000000 R14: 00007fb754da5fa0 R15: 00007fff0d5790d8
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x127d7f
flags: 0x200000000000000(node=0|zone=2)
raw: 0200000000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 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 0x29c2(GFP_NOWAIT|__GFP_HIGHMEM|__GFP_IO|__GFP_FS|__GFP_ZERO), pid 2968, tgid 2968 (syz-executor), ts 45478868673, free_ts 1497852865483
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1af/0x220 mm/page_alloc.c:1846
prep_new_page mm/page_alloc.c:1854 [inline]
get_page_from_freelist+0x1058/0x3cb0 mm/page_alloc.c:3915
__alloc_frozen_pages_noprof+0x259/0x21c0 mm/page_alloc.c:5210
alloc_pages_mpol+0xe4/0x410 mm/mempolicy.c:2486
alloc_frozen_pages_noprof mm/mempolicy.c:2557 [inline]
alloc_pages_noprof+0x131/0x390 mm/mempolicy.c:2577
vm_area_alloc_pages mm/vmalloc.c:3649 [inline]
__vmalloc_area_node mm/vmalloc.c:3863 [inline]
__vmalloc_node_range_noprof+0xe6c/0x16b0 mm/vmalloc.c:4051
vmalloc_user_noprof+0x9e/0xe0 mm/vmalloc.c:4205
kcov_ioctl+0x4c/0x6e0 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/0x570 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 2979 tgid 2979 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0x795/0x1010 mm/page_alloc.c:2943
vfree+0x1fd/0xb50 mm/vmalloc.c:3466
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:233
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0x87f/0x2bd0 kernel/exit.c:971
do_group_exit+0xd3/0x2a0 kernel/exit.c:1112
get_signal+0x2671/0x26d0 kernel/signal.c:3034
arch_do_signal_or_restart+0x8f/0x7e0 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:41 [inline]
exit_to_user_mode_loop+0x80/0x4f0 kernel/entry/common.c:75
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline]
do_syscall_64+0x4bb/0x570 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888127d7fe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888127d7ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888127d7ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888127d80000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888127d80080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: 03 0f add (%rdi),%ecx
2: b6 04 mov $0x4,%dh
4: 02 84 c0 74 08 3c 03 add 0x33c0874(%rax,%rax,8),%al
b: 0f 8e ad 00 00 00 jle 0xbe
11: 31 c0 xor %eax,%eax
13: 3b 6b 08 cmp 0x8(%rbx),%ebp
16: 0f 83 81 00 00 00 jae 0x9d
1c: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
23: fc ff df
26: 48 8d 7b 0c lea 0xc(%rbx),%rdi
* 2a: 48 89 fa mov %rdi,%rdx <-- trapping instruction
2d: 48 c1 ea 03 shr $0x3,%rdx
31: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx
35: 48 89 f8 mov %rdi,%rax
38: 83 e0 07 and $0x7,%eax
3b: 83 c0 03 add $0x3,%eax
3e: 38 d0 cmp %dl,%al