==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0x110d/0x1140 drivers/hid/hid-mcp2221.c:975
Read of size 1 at addr ffff888077c33fff by task kworker/1:6/5777
CPU: 1 UID: 0 PID: 5777 Comm: kworker/1:6 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/05/2026
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1c0 mm/kasan/report.c:595
mcp2221_raw_event+0x110d/0x1140 drivers/hid/hid-mcp2221.c:975
__hid_input_report.constprop.0+0x319/0x470 drivers/hid/hid-core.c:2175
hid_irq_in+0x55d/0x710 drivers/hid/usbhid/hid-core.c:287
__usb_hcd_giveback_urb+0x38e/0x610 drivers/usb/core/hcd.c:1657
usb_hcd_giveback_urb+0x3ca/0x4a0 drivers/usb/core/hcd.c:1741
dummy_timer+0xdb2/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:2019
__run_hrtimer kernel/time/hrtimer.c:2074 [inline]
__hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2131
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2148
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0x16a/0x210 kernel/softirq.c:758
irq_exit_rcu+0x9/0x30 kernel/softirq.c:775
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch.isra.0+0x2ca/0x10d0 kernel/sched/core.c:5377
Code: b6 0a 00 00 41 c7 87 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 8d 7f 48 e8 73 dc fb 09 e8 fe 25 3d 00 fb 48 8d bb 10 17 00 00 <48> b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 04 02 84
RSP: 0018:ffffc90004d0e110 EFLAGS: 00000202
RAX: 0000000000006367 RBX: ffff88803848be80 RCX: 0000000000000040
RDX: 0000000000000001 RSI: ffffffff8e391042 RDI: ffff88803848d590
RBP: ffffc90004d0e168 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: ffff88807ba2ddc0
R13: 0000000000000000 R14: ffffffff91458ce4 R15: ffff8880b853c040
context_switch kernel/sched/core.c:5529 [inline]
__schedule+0x1261/0x6920 kernel/sched/core.c:7277
preempt_schedule_common+0x3c/0xb0 kernel/sched/core.c:7456
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
idr_preload_end include/linux/idr.h:191 [inline]
__kernfs_new_node+0x75a/0xa10 fs/kernfs/dir.c:677
kernfs_new_node fs/kernfs/dir.c:751 [inline]
kernfs_create_dir_ns+0xa6/0x2b0 fs/kernfs/dir.c:1120
sysfs_create_dir_ns+0x13a/0x2b0 fs/sysfs/dir.c:59
create_dir lib/kobject.c:73 [inline]
kobject_add_internal+0x2c8/0x930 lib/kobject.c:240
kobject_add_varg lib/kobject.c:374 [inline]
kobject_add+0x16a/0x1e0 lib/kobject.c:426
class_dir_create_and_add drivers/base/core.c:3304 [inline]
get_device_parent+0x382/0x4c0 drivers/base/core.c:3355
device_add+0x1ad/0x1970 drivers/base/core.c:3685
cdev_device_add+0x12b/0x270 fs/char_dev.c:553
i2cdev_attach_adapter+0x36b/0x4c0 drivers/i2c/i2c-dev.c:691
i2cdev_notifier_call+0x65/0x80 drivers/i2c/i2c-dev.c:729
notifier_call_chain+0x99/0x3f0 kernel/notifier.c:85
blocking_notifier_call_chain kernel/notifier.c:380 [inline]
blocking_notifier_call_chain+0x69/0xa0 kernel/notifier.c:368
bus_notify+0x56/0x80 drivers/base/bus.c:1086
device_add+0x1169/0x1970 drivers/base/core.c:3741
i2c_register_adapter+0x862/0x13f0 drivers/i2c/i2c-core-base.c:1616
i2c_add_adapter drivers/i2c/i2c-core-base.c:1691 [inline]
devm_i2c_add_adapter+0x89/0x120 drivers/i2c/i2c-core-base.c:1878
mcp2221_probe.cold+0x60e/0xf16 drivers/hid/hid-mcp2221.c:1319
__hid_device_probe drivers/hid/hid-core.c:2839 [inline]
hid_device_probe+0x4fe/0x850 drivers/hid/hid-core.c:2878
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
hid_add_device+0x2bf/0x440 drivers/hid/hid-core.c:3065
usbhid_probe+0xa64/0x10b0 drivers/hid/usbhid/hid-core.c:1452
usb_probe_interface+0x386/0x9b0 drivers/usb/core/driver.c:399
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_set_configuration+0xd97/0x1c60 drivers/usb/core/message.c:2268
usb_generic_driver_probe+0xa1/0xe0 drivers/usb/core/generic.c:250
usb_probe_device+0xef/0x400 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_new_device.part.0+0xcc2/0x1686 drivers/usb/core/hub.c:2708
usb_new_device include/linux/workqueue.h:715 [inline]
hub_port_connect drivers/usb/core/hub.c:5580 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5720 [inline]
port_event drivers/usb/core/hub.c:5884 [inline]
hub_event.cold+0x1e3/0xe90 drivers/usb/core/hub.c:5966
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396
process_scheduled_works kernel/workqueue.c:3479 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
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:0xffff888000000000 pfn:0x77c33
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: ffff888000000000 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 5631, tgid 5631 (syz-executor), ts 100791211026
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871
prep_new_page mm/page_alloc.c:1879 [inline]
get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943
__alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436
alloc_pages_mpol+0x201/0x550 mm/mempolicy.c:2486
alloc_pages_noprof+0x1a/0x160 mm/mempolicy.c:2577
pagetable_alloc_noprof include/linux/mm.h:3794 [inline]
pmd_alloc_one_noprof include/asm-generic/pgalloc.h:143 [inline]
__pmd_alloc+0x3b/0x950 mm/memory.c:6962
pmd_alloc include/linux/mm.h:3710 [inline]
copy_pmd_range mm/memory.c:1470 [inline]
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0x3e98/0x57c0 mm/memory.c:1637
dup_mmap+0x1230/0x2370 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm kernel/fork.c:1595 [inline]
copy_process+0x4811/0x8370 kernel/fork.c:2310
kernel_clone+0x176/0x9d0 kernel/fork.c:2769
__do_sys_clone+0xd9/0x120 kernel/fork.c:2911
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 24 tgid 24 ts 101014926668 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1418 [inline]
__free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962
__pagetable_free include/linux/mm.h:3804 [inline]
pagetable_free include/linux/mm.h:3828 [inline]
pagetable_dtor_free include/linux/mm.h:3927 [inline]
__tlb_remove_table include/asm-generic/tlb.h:221 [inline]
__tlb_remove_table_free mm/mmu_gather.c:228 [inline]
tlb_remove_table_rcu+0x2cf/0x380 mm/mmu_gather.c:291
rcu_do_batch kernel/rcu/tree.c:2650 [inline]
rcu_core+0x5f0/0x1260 kernel/rcu/tree.c:2919
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
run_ksoftirqd kernel/softirq.c:1099 [inline]
run_ksoftirqd+0x38/0x60 kernel/softirq.c:1091
smpboot_thread_fn+0x3d3/0xab0 kernel/smpboot.c:160
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Memory state around the buggy address:
ffff888077c33e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888077c33f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888077c33f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888077c34000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888077c34080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: b6 0a mov $0xa,%dh
2: 00 00 add %al,(%rax)
4: 41 c7 87 20 0e 00 00 movl $0x0,0xe20(%r15)
b: 00 00 00 00
f: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
14: 49 8d 7f 48 lea 0x48(%r15),%rdi
18: e8 73 dc fb 09 call 0x9fbdc90
1d: e8 fe 25 3d 00 call 0x3d2620
22: fb sti
23: 48 8d bb 10 17 00 00 lea 0x1710(%rbx),%rdi
* 2a: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction
31: fc ff df
34: 48 89 fa mov %rdi,%rdx
37: 48 c1 ea 03 shr $0x3,%rdx
3b: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
3f: 84 .byte 0x84