==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0xf94/0x1030 drivers/hid/hid-mcp2221.c:852
Read of size 1 at addr ffff888130e53fff by task kworker/0:0/9
CPU: 0 UID: 0 PID: 9 Comm: kworker/0:0 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
Workqueue: usb_hub_wq hub_event
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:unwind_next_frame+0x516/0x20a0 arch/x86/kernel/unwind_orc.c:505
Code: c0 0f 84 05 fe ff ff 48 b8 00 00 00 00 00 fc ff df 4c 8d 79 05 4c 89 fa 48 c1 ea 03 0f b6 04 02 4c 89 fa 83 e2 07 38 d0 7f 08 <84> c0 0f 85 32 14 00 00 0f b6 41 05 83 e0 07 0f 84 53 fe ff ff 3c
RSP: 0018:ffffc9000009e518 EFLAGS: 00000297
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff8b0016dc
RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffffff8a9f6c60
RBP: ffffc9000009e5d0 R08: ffffffff8b001718 R09: 0000000000000000
R10: 0000000000000007 R11: 0000000000026aab R12: ffffc9000009e5d8
R13: ffffc9000009e588 R14: ffffc9000009e5bd R15: ffffffff8b0016e1
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
unpoison_slab_object mm/kasan/common.c:319 [inline]
__kasan_slab_alloc+0x6e/0x70 mm/kasan/common.c:345
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4161 [inline]
slab_alloc_node mm/slub.c:4210 [inline]
kmem_cache_alloc_noprof+0x14f/0x3b0 mm/slub.c:4217
lsm_inode_alloc security/security.c:755 [inline]
security_inode_alloc+0x3b/0x140 security/security.c:1697
inode_init_always_gfp+0xc9b/0xfe0 fs/inode.c:306
inode_init_always include/linux/fs.h:3226 [inline]
alloc_inode+0x86/0x240 fs/inode.c:353
new_inode+0x22/0x1c0 fs/inode.c:1145
debugfs_get_inode fs/debugfs/inode.c:72 [inline]
debugfs_create_dir+0xdd/0x5f0 fs/debugfs/inode.c:597
i2c_register_adapter+0x44e/0x1470 drivers/i2c/i2c-core-base.c:1576
i2c_add_adapter+0x117/0x1c0 drivers/i2c/i2c-core-base.c:1671
devm_i2c_add_adapter+0x1b/0x90 drivers/i2c/i2c-core-base.c:1843
mcp2221_probe+0x5f1/0xc50 drivers/hid/hid-mcp2221.c:1193
__hid_device_probe drivers/hid/hid-core.c:2717 [inline]
hid_device_probe+0x354/0x710 drivers/hid/hid-core.c:2754
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x23e/0xa90 drivers/base/dd.c:657
__driver_probe_device+0x1de/0x440 drivers/base/dd.c:799
driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829
__device_attach_driver+0x1df/0x310 drivers/base/dd.c:957
bus_for_each_drv+0x156/0x1e0 drivers/base/bus.c:462
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1029
bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:537
device_add+0x1148/0x1a70 drivers/base/core.c:3692
hid_add_device+0x373/0xa60 drivers/hid/hid-core.c:2900
usbhid_probe+0xd38/0x13f0 drivers/hid/usbhid/hid-core.c:1432
usb_probe_interface+0x300/0x9c0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x23e/0xa90 drivers/base/dd.c:657
__driver_probe_device+0x1de/0x440 drivers/base/dd.c:799
driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829
__device_attach_driver+0x1df/0x310 drivers/base/dd.c:957
bus_for_each_drv+0x156/0x1e0 drivers/base/bus.c:462
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1029
bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:537
device_add+0x1148/0x1a70 drivers/base/core.c:3692
usb_set_configuration+0x1187/0x1e20 drivers/usb/core/message.c:2210
usb_generic_driver_probe+0xb1/0x110 drivers/usb/core/generic.c:250
usb_probe_device+0xec/0x3e0 drivers/usb/core/driver.c:291
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x23e/0xa90 drivers/base/dd.c:657
__driver_probe_device+0x1de/0x440 drivers/base/dd.c:799
driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829
__device_attach_driver+0x1df/0x310 drivers/base/dd.c:957
bus_for_each_drv+0x156/0x1e0 drivers/base/bus.c:462
__device_attach+0x1e4/0x4b0 drivers/base/dd.c:1029
bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:537
device_add+0x1148/0x1a70 drivers/base/core.c:3692
usb_new_device+0xd07/0x1a20 drivers/usb/core/hub.c:2663
hub_port_connect drivers/usb/core/hub.c:5535 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5675 [inline]
port_event drivers/usb/core/hub.c:5835 [inline]
hub_event+0x2f85/0x5030 drivers/usb/core/hub.c:5917
process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3319 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400
kthread+0x3c2/0x780 kernel/kthread.c:464
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888100000000 pfn:0x130e53
flags: 0x200000000000000(node=0|zone=2)
raw: 0200000000000000 0000000000000000 00000000ffffffff 0000000000000000
raw: ffff888100000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5250, tgid 5250 (udevd), ts 3509628211854, free_ts 3555059186958
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_slab_page mm/slub.c:2468 [inline]
allocate_slab mm/slub.c:2632 [inline]
new_slab+0x244/0x340 mm/slub.c:2686
___slab_alloc+0xda5/0x1940 mm/slub.c:3872
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3962
__slab_alloc_node mm/slub.c:4037 [inline]
slab_alloc_node mm/slub.c:4198 [inline]
__kmalloc_cache_noprof+0x209/0x3c0 mm/slub.c:4367
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
kernfs_fop_open+0x244/0xda0 fs/kernfs/file.c:623
do_dentry_open+0x6d7/0x13a0 fs/open.c:956
vfs_open+0x82/0x3f0 fs/open.c:1086
do_open fs/namei.c:3880 [inline]
path_openat+0x1e5e/0x2d40 fs/namei.c:4039
do_filp_open+0x20b/0x470 fs/namei.c:4066
do_sys_openat2+0x11b/0x1d0 fs/open.c:1429
do_sys_open fs/open.c:1444 [inline]
__do_sys_openat fs/open.c:1460 [inline]
__se_sys_openat fs/open.c:1455 [inline]
__x64_sys_openat+0x174/0x210 fs/open.c:1455
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94
page last free pid 5395 tgid 5395 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
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x4e/0x70 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4161 [inline]
slab_alloc_node mm/slub.c:4210 [inline]
kmem_cache_alloc_noprof+0x14f/0x3b0 mm/slub.c:4217
getname_flags.part.0+0x4c/0x550 fs/namei.c:146
getname_flags+0x93/0xf0 include/linux/audit.h:322
getname include/linux/fs.h:2852 [inline]
getname_maybe_null include/linux/fs.h:2859 [inline]
getname_maybe_null include/linux/fs.h:2856 [inline]
vfs_fstatat+0xe1/0xf0 fs/stat.c:367
__do_sys_newfstatat+0xa1/0x130 fs/stat.c:536
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
Memory state around the buggy address:
ffff888130e53e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888130e53f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888130e53f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888130e54000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888130e54080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 0f 84 05 fe ff ff je 0xfffffe0b
6: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
d: fc ff df
10: 4c 8d 79 05 lea 0x5(%rcx),%r15
14: 4c 89 fa mov %r15,%rdx
17: 48 c1 ea 03 shr $0x3,%rdx
1b: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
1f: 4c 89 fa mov %r15,%rdx
22: 83 e2 07 and $0x7,%edx
25: 38 d0 cmp %dl,%al
27: 7f 08 jg 0x31
* 29: 84 c0 test %al,%al <-- trapping instruction
2b: 0f 85 32 14 00 00 jne 0x1463
31: 0f b6 41 05 movzbl 0x5(%rcx),%eax
35: 83 e0 07 and $0x7,%eax
38: 0f 84 53 fe ff ff je 0xfffffe91
3e: 3c .byte 0x3c