==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0xf94/0x1030 drivers/hid/hid-mcp2221.c:852
Read of size 1 at addr ffff888113237fff by task syz.3.7101/1953
CPU: 0 UID: 0 PID: 1953 Comm: syz.3.7101 Not tainted 6.15.0-rc4-syzkaller-00104-g588d032e9e56 #0 PREEMPT(voluntary)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/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:408 [inline]
print_report+0xc3/0x670 mm/kasan/report.c:521
kasan_report+0xe0/0x110 mm/kasan/report.c:634
mcp2221_raw_event+0xf94/0x1030 drivers/hid/hid-mcp2221.c:852
__hid_input_report.constprop.0+0x311/0x450 drivers/hid/hid-core.c:2117
hid_irq_in+0x35e/0x870 drivers/hid/usbhid/hid-core.c:286
__usb_hcd_giveback_urb+0x38a/0x6e0 drivers/usb/core/hcd.c:1650
usb_hcd_giveback_urb+0x39b/0x450 drivers/usb/core/hcd.c:1734
dummy_timer+0x180e/0x3a20 drivers/usb/gadget/udc/dummy_hcd.c:1994
__run_hrtimer kernel/time/hrtimer.c:1761 [inline]
__hrtimer_run_queues+0x1ff/0xad0 kernel/time/hrtimer.c:1825
hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1842
handle_softirqs+0x205/0x8d0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0xfa/0x160 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1049
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:__orc_find+0x3d/0xf0 arch/x86/kernel/unwind_orc.c:104
Code: 53 48 83 ec 08 85 d2 0f 84 99 00 00 00 49 89 fe 48 89 f0 49 39 fc 72 7b 48 b9 00 00 00 00 00 fc ff df 49 89 ff 48 89 fd eb 0c <48> 8d 6b 04 49 89 df 49 39 ec 72 4e 4c 89 e2 48 29 ea 48 89 d6 48
RSP: 0018:ffffc90002ea7968 EFLAGS: 00000206
RAX: ffffffff8ae09cee RBX: ffffffff8a8a70a8 RCX: dffffc0000000000
RDX: ffffffff81e49e37 RSI: 0000000000000000 RDI: ffffffff8a8a708c
RBP: ffffffff8a8a70a8 R08: ffffffff8ae09d1e R09: 0000000000000000
R10: 0000000000000000 R11: 000000000000e49e R12: ffffffff8a8a70a8
R13: ffffffff81e49ebf R14: ffffffff8a8a708c R15: ffffffff8a8a70a4
orc_find arch/x86/kernel/unwind_orc.c:227 [inline]
unwind_next_frame+0x2ec/0x20a0 arch/x86/kernel/unwind_orc.c:494
arch_stack_walk+0x94/0x100 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x8e/0xc0 kernel/stacktrace.c:122
kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
kasan_save_track+0x14/0x30 mm/kasan/common.c:68
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x37/0x50 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2398 [inline]
slab_free mm/slub.c:4656 [inline]
kfree+0x286/0x470 mm/slub.c:4855
raw_ioctl_ep_write drivers/usb/gadget/legacy/raw_gadget.c:1153 [inline]
raw_ioctl+0xab6/0x2c30 drivers/usb/gadget/legacy/raw_gadget.c:1324
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb7ca94e56b
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:00007fb7c8fb5f70 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fb7ca94e56b
RDX: 00007fb7c8fb5ff0 RSI: 0000000040085507 RDI: 0000000000000003
RBP: 0000000000000003 R08: 00007fb7caca0320 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 0000200000000040
R13: 0000000000000000 R14: 00007fb7cab75fa0 R15: 00007ffd1ace41d8
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888113237dc0 pfn:0x113237
flags: 0x200000000000000(node=0|zone=2)
raw: 0200000000000000 dead000000000100 dead000000000122 0000000000000000
raw: ffff888113237dc0 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 0x440dc0(GFP_KERNEL_ACCOUNT|__GFP_ZERO|__GFP_COMP), pid 30775, tgid 30775 (syz-executor), ts 3253694421250, free_ts 3256861140094
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1718
prep_new_page mm/page_alloc.c:1726 [inline]
get_page_from_freelist+0xfec/0x2d90 mm/page_alloc.c:3688
__alloc_frozen_pages_noprof+0x25c/0x2160 mm/page_alloc.c:4970
alloc_pages_mpol+0xe4/0x410 mm/mempolicy.c:2301
alloc_frozen_pages_noprof mm/mempolicy.c:2372 [inline]
alloc_pages_noprof+0x131/0x390 mm/mempolicy.c:2392
pagetable_alloc_noprof include/linux/mm.h:3002 [inline]
__pte_alloc_one_noprof include/asm-generic/pgalloc.h:70 [inline]
pte_alloc_one+0x19/0x380 arch/x86/mm/pgtable.c:17
__pte_alloc+0x6d/0x3c0 mm/memory.c:430
copy_pte_range mm/memory.c:1100 [inline]
copy_pmd_range mm/memory.c:1255 [inline]
copy_pud_range mm/memory.c:1292 [inline]
copy_p4d_range mm/memory.c:1316 [inline]
copy_page_range+0x2d19/0x5710 mm/memory.c:1410
dup_mmap kernel/fork.c:726 [inline]
dup_mm kernel/fork.c:1734 [inline]
copy_mm kernel/fork.c:1786 [inline]
copy_process+0x89cb/0x92e0 kernel/fork.c:2429
kernel_clone+0xfc/0x960 kernel/fork.c:2844
__do_sys_clone+0xce/0x120 kernel/fork.c:2987
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 32326 tgid 32326 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1262 [inline]
__free_frozen_pages+0x66c/0xe70 mm/page_alloc.c:2725
pagetable_free include/linux/mm.h:3019 [inline]
pagetable_dtor_free include/linux/mm.h:3117 [inline]
__tlb_remove_table include/asm-generic/tlb.h:215 [inline]
__tlb_remove_table_free mm/mmu_gather.c:227 [inline]
tlb_remove_table_rcu+0x116/0x1a0 mm/mmu_gather.c:290
rcu_do_batch kernel/rcu/tree.c:2568 [inline]
rcu_core+0x799/0x14e0 kernel/rcu/tree.c:2824
handle_softirqs+0x205/0x8d0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0xfa/0x160 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1049
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
Memory state around the buggy address:
ffff888113237e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888113237f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888113237f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888113238000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888113238080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: 53 push %rbx
1: 48 83 ec 08 sub $0x8,%rsp
5: 85 d2 test %edx,%edx
7: 0f 84 99 00 00 00 je 0xa6
d: 49 89 fe mov %rdi,%r14
10: 48 89 f0 mov %rsi,%rax
13: 49 39 fc cmp %rdi,%r12
16: 72 7b jb 0x93
18: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx
1f: fc ff df
22: 49 89 ff mov %rdi,%r15
25: 48 89 fd mov %rdi,%rbp
28: eb 0c jmp 0x36
* 2a: 48 8d 6b 04 lea 0x4(%rbx),%rbp <-- trapping instruction
2e: 49 89 df mov %rbx,%r15
31: 49 39 ec cmp %rbp,%r12
34: 72 4e jb 0x84
36: 4c 89 e2 mov %r12,%rdx
39: 48 29 ea sub %rbp,%rdx
3c: 48 89 d6 mov %rdx,%rsi
3f: 48 rex.W