==================================================================
BUG: KASAN: slab-out-of-bounds in mcp2221_raw_event+0x1062/0x1240 drivers/hid/hid-mcp2221.c:856
Read of size 1 at addr ffff888030e97fff by task kworker/0:5/5854
CPU: 0 PID: 5854 Comm: kworker/0:5 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Workqueue: usb_hub_wq hub_event
Call Trace:
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xac/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
mcp2221_raw_event+0x1062/0x1240 drivers/hid/hid-mcp2221.c:856
hid_input_report+0x400/0x520 drivers/hid/hid-core.c:2095
hid_irq_in+0x479/0x6d0 drivers/hid/usbhid/hid-core.c:284
__usb_hcd_giveback_urb+0x35f/0x520 drivers/usb/core/hcd.c:1650
dummy_timer+0x88a/0x3140 drivers/usb/gadget/udc/dummy_hcd.c:1993
__run_hrtimer kernel/time/hrtimer.c:1750 [inline]
__hrtimer_run_queues+0x51e/0xc40 kernel/time/hrtimer.c:1814
hrtimer_run_softirq+0x187/0x2b0 kernel/time/hrtimer.c:1831
handle_softirqs+0x280/0x820 kernel/softirq.c:578
__do_softirq kernel/softirq.c:612 [inline]
invoke_softirq kernel/softirq.c:452 [inline]
__irq_exit_rcu+0xc7/0x190 kernel/softirq.c:661
irq_exit_rcu+0x9/0x20 kernel/softirq.c:673
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1088 [inline]
sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1088
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:687
RIP: 0010:finish_task_switch+0x26a/0x920 kernel/sched/core.c:5254
Code: 0f 84 37 01 00 00 48 85 db 0f 85 56 01 00 00 0f 1f 44 00 00 4c 8b 75 d0 4c 89 e7 e8 a0 87 1c 09 e8 0b a4 2f 00 fb 4c 8b 65 c0 <49> 8d bc 24 f8 15 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 28 84 c0
RSP: 0018:ffffc90004dae2d8 EFLAGS: 00000286
RAX: 366fe9bff1758f00 RBX: 0000000000000000 RCX: 366fe9bff1758f00
RDX: dffffc0000000000 RSI: ffffffff8aaabce0 RDI: ffffffff8afc6f40
RBP: ffffc90004dae330 R08: ffffffff90da9537 R09: 1ffffffff21b52a6
R10: dffffc0000000000 R11: fffffbfff21b52a7 R12: ffff88805c00da00
R13: dffffc0000000000 R14: ffff88802cad9e00 R15: ffff8880b8e3cac8
context_switch kernel/sched/core.c:5383 [inline]
__schedule+0x14da/0x44d0 kernel/sched/core.c:6699
preempt_schedule_irq+0xb5/0x140 kernel/sched/core.c:7009
irqentry_exit+0x67/0x70 kernel/entry/common.c:438
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:687
RIP: 0010:get_kobj_path_length lib/kobject.c:-1 [inline]
RIP: 0010:kobject_get_path+0x91/0x2c0 lib/kobject.c:158
Code: a5 85 04 00 48 89 c3 49 83 c6 18 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df 80 3c 08 00 74 08 4c 89 f7 e8 9f e1 81 f7 <49> 63 c4 4c 8d 64 18 01 4d 8b 36 4d 85 f6 75 95 31 ff 44 89 e6 e8
RSP: 0018:ffffc90004dae6a8 EFLAGS: 00000246
RAX: 1ffff1100b3dba18 RBX: 0000000000000003 RCX: dffffc0000000000
RDX: ffffc90016ed6000 RSI: 0000000000087ceb RDI: ffff888025c937a8
RBP: 0000000000000dc0 R08: ffffffff90da9537 R09: 1ffffffff21b52a6
R10: dffffc0000000000 R11: fffffbfff21b52a7 R12: 0000000000000031
R13: ffff88801f3b0018 R14: ffff888059edd0c0 R15: 1ffff11003e7600a
kobject_uevent_env+0x28a/0x8c0 lib/kobject_uevent.c:544
device_add+0x5e8/0xc20 drivers/base/core.c:3664
cdev_device_add+0x1d6/0x390 fs/char_dev.c:556
i2cdev_attach_adapter+0x2eb/0x4e0 drivers/i2c/i2c-dev.c:676
notifier_call_chain+0x197/0x390 kernel/notifier.c:93
blocking_notifier_call_chain+0x6a/0x90 kernel/notifier.c:388
bus_notify+0x13e/0x180 drivers/base/bus.c:998
device_add+0x5de/0xc20 drivers/base/core.c:3663
i2c_register_adapter+0x372/0xfb0 drivers/i2c/i2c-core-base.c:1551
devm_i2c_add_adapter+0x1b/0x80 drivers/i2c/i2c-core-base.c:1842
mcp2221_probe+0x300/0x760 drivers/hid/hid-mcp2221.c:1196
__hid_device_probe drivers/hid/hid-core.c:2644 [inline]
hid_device_probe+0x293/0x5b0 drivers/hid/hid-core.c:2681
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x25b/0xb40 drivers/base/dd.c:658
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:800
driver_probe_device+0x4f/0x420 drivers/base/dd.c:830
__device_attach_driver+0x2ca/0x520 drivers/base/dd.c:958
bus_for_each_drv+0x24b/0x2d0 drivers/base/bus.c:459
__device_attach+0x2b5/0x400 drivers/base/dd.c:1030
bus_probe_device+0x180/0x260 drivers/base/bus.c:534
device_add+0x85b/0xc20 drivers/base/core.c:3683
hid_add_device+0x38d/0x530 drivers/hid/hid-core.c:2827
usbhid_probe+0xe02/0x1220 drivers/hid/usbhid/hid-core.c:1432
usb_probe_interface+0x5a4/0xb00 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x25b/0xb40 drivers/base/dd.c:658
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:800
driver_probe_device+0x4f/0x420 drivers/base/dd.c:830
__device_attach_driver+0x2ca/0x520 drivers/base/dd.c:958
bus_for_each_drv+0x24b/0x2d0 drivers/base/bus.c:459
__device_attach+0x2b5/0x400 drivers/base/dd.c:1030
bus_probe_device+0x180/0x260 drivers/base/bus.c:534
device_add+0x85b/0xc20 drivers/base/core.c:3683
usb_set_configuration+0x1a79/0x20c0 drivers/usb/core/message.c:2207
usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x13d/0x280 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x25b/0xb40 drivers/base/dd.c:658
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:800
driver_probe_device+0x4f/0x420 drivers/base/dd.c:830
__device_attach_driver+0x2ca/0x520 drivers/base/dd.c:958
bus_for_each_drv+0x24b/0x2d0 drivers/base/bus.c:459
__device_attach+0x2b5/0x400 drivers/base/dd.c:1030
bus_probe_device+0x180/0x260 drivers/base/bus.c:534
device_add+0x85b/0xc20 drivers/base/core.c:3683
usb_new_device+0xa31/0x1630 drivers/usb/core/hub.c:2660
hub_port_connect drivers/usb/core/hub.c:5529 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5669 [inline]
port_event drivers/usb/core/hub.c:5833 [inline]
hub_event+0x2962/0x49c0 drivers/usb/core/hub.c:5915
process_one_work kernel/workqueue.c:2634 [inline]
process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
kthread+0x2fa/0x390 kernel/kthread.c:388
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
Allocated by task 5784:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:198 [inline]
__do_kmalloc_node mm/slab_common.c:1007 [inline]
__kmalloc+0xb4/0x240 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
tomoyo_realpath_from_path+0xe3/0x5d0 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_number_perm+0x1ea/0x590 security/tomoyo/file.c:723
tomoyo_path_mkdir+0xa9/0xe0 security/tomoyo/tomoyo.c:178
security_path_mkdir+0xe4/0x140 security/security.c:1734
do_mkdirat+0x15a/0x440 fs/namei.c:4141
__do_sys_mkdirat fs/namei.c:4159 [inline]
__se_sys_mkdirat fs/namei.c:4157 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4157
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 5784:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:164 [inline]
slab_free_hook mm/slub.c:1811 [inline]
slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1837
slab_free mm/slub.c:3830 [inline]
__kmem_cache_free+0xba/0x1f0 mm/slub.c:3843
tomoyo_realpath_from_path+0x59d/0x5d0 security/tomoyo/realpath.c:286
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_number_perm+0x1ea/0x590 security/tomoyo/file.c:723
tomoyo_path_mkdir+0xa9/0xe0 security/tomoyo/tomoyo.c:178
security_path_mkdir+0xe4/0x140 security/security.c:1734
do_mkdirat+0x15a/0x440 fs/namei.c:4141
__do_sys_mkdirat fs/namei.c:4159 [inline]
__se_sys_mkdirat fs/namei.c:4157 [inline]
__x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4157
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff888030e96000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 4095 bytes to the right of
allocated 4096-byte region [ffff888030e96000, ffff888030e97000)
The buggy address belongs to the physical page:
page:ffffea0000c3a400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x30e90
head:ffffea0000c3a400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888017842140 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5784, tgid 5784 (syz-executor), ts 93625309882, free_ts 93601847179
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
prep_new_page mm/page_alloc.c:1561 [inline]
get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
__alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
alloc_slab_page+0x5d/0x170 mm/slub.c:1881
allocate_slab mm/slub.c:2028 [inline]
new_slab+0x87/0x2e0 mm/slub.c:2081
___slab_alloc+0xc6d/0x1300 mm/slub.c:3253
__slab_alloc mm/slub.c:3339 [inline]
__slab_alloc_node mm/slub.c:3392 [inline]
slab_alloc_node mm/slub.c:3485 [inline]
__kmem_cache_alloc_node+0x1a2/0x260 mm/slub.c:3534
__do_kmalloc_node mm/slab_common.c:1006 [inline]
__kmalloc+0xa4/0x240 mm/slab_common.c:1020
kmalloc include/linux/slab.h:604 [inline]
tomoyo_realpath_from_path+0xe3/0x5d0 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x20f/0x4b0 security/tomoyo/file.c:822
security_inode_getattr+0xd3/0x120 security/security.c:2153
vfs_getattr fs/stat.c:173 [inline]
vfs_statx+0x15f/0x6d0 fs/stat.c:248
vfs_fstatat+0x12a/0x1b0 fs/stat.c:299
__do_sys_newfstatat fs/stat.c:463 [inline]
__se_sys_newfstatat fs/stat.c:457 [inline]
__x64_sys_newfstatat+0x117/0x190 fs/stat.c:457
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1154 [inline]
free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
discard_slab mm/slub.c:2127 [inline]
__unfreeze_partials+0x1cf/0x210 mm/slub.c:2667
put_cpu_partial+0x17c/0x250 mm/slub.c:2743
__slab_free+0x31d/0x410 mm/slub.c:3700
qlink_free mm/kasan/quarantine.c:166 [inline]
qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:185
kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
slab_alloc_node mm/slub.c:3495 [inline]
slab_alloc mm/slub.c:3503 [inline]
__kmem_cache_alloc_lru mm/slub.c:3510 [inline]
kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3519
getname_flags+0xbb/0x500 fs/namei.c:140
do_sys_openat2+0xcb/0x1c0 fs/open.c:1415
do_sys_open fs/open.c:1436 [inline]
__do_sys_openat fs/open.c:1452 [inline]
__se_sys_openat fs/open.c:1447 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1447
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Memory state around the buggy address:
ffff888030e97e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888030e97f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888030e97f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff888030e98000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888030e98080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: 0f 84 37 01 00 00 je 0x13d
6: 48 85 db test %rbx,%rbx
9: 0f 85 56 01 00 00 jne 0x165
f: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
14: 4c 8b 75 d0 mov -0x30(%rbp),%r14
18: 4c 89 e7 mov %r12,%rdi
1b: e8 a0 87 1c 09 call 0x91c87c0
20: e8 0b a4 2f 00 call 0x2fa430
25: fb sti
26: 4c 8b 65 c0 mov -0x40(%rbp),%r12
* 2a: 49 8d bc 24 f8 15 00 lea 0x15f8(%r12),%rdi <-- trapping instruction
31: 00
32: 48 89 f8 mov %rdi,%rax
35: 48 c1 e8 03 shr $0x3,%rax
39: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax
3e: 84 c0 test %al,%al