==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0x106a/0x1240 drivers/hid/hid-mcp2221.c:948
Read of size 1 at addr ffff888062633fff by task syz.0.1072/9539
CPU: 0 UID: 0 PID: 9539 Comm: syz.0.1072 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xca/0x240 mm/kasan/report.c:482
kasan_report+0x118/0x150 mm/kasan/report.c:595
mcp2221_raw_event+0x106a/0x1240 drivers/hid/hid-mcp2221.c:948
__hid_input_report drivers/hid/hid-core.c:2139 [inline]
hid_input_report+0x41d/0x580 drivers/hid/hid-core.c:2166
hid_irq_in+0x47e/0x6d0 drivers/hid/usbhid/hid-core.c:286
__usb_hcd_giveback_urb+0x376/0x540 drivers/usb/core/hcd.c:1661
dummy_timer+0x85f/0x45b0 drivers/usb/gadget/udc/dummy_hcd.c:1995
__run_hrtimer kernel/time/hrtimer.c:1777 [inline]
__hrtimer_run_queues+0x52c/0xc60 kernel/time/hrtimer.c:1841
hrtimer_run_softirq+0x187/0x2b0 kernel/time/hrtimer.c:1858
handle_softirqs+0x286/0x870 kernel/softirq.c:622
__do_softirq kernel/softirq.c:656 [inline]
invoke_softirq kernel/softirq.c:496 [inline]
__irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:723
irq_exit_rcu+0x9/0x30 kernel/softirq.c:739
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1052 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1052
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697
RIP: 0010:finish_task_switch+0x26b/0x950 kernel/sched/core.c:5122
Code: 0f 84 3c 01 00 00 48 85 db 0f 85 63 01 00 00 0f 1f 44 00 00 4c 8b 75 d0 4c 89 e7 e8 1f 51 c5 09 e8 6a d7 36 00 fb 4c 8b 65 c0 <49> 8d bc 24 58 16 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 28 84 c0
RSP: 0018:ffffc90003947c38 EFLAGS: 00000282
RAX: 086eda318b76c100 RBX: 0000000000000000 RCX: 086eda318b76c100
RDX: 0000000000000000 RSI: ffffffff8d779c30 RDI: ffffffff8bbf2040
RBP: ffffc90003947c90 R08: ffffffff8f7d5a77 R09: 1ffffffff1efab4e
R10: dffffc0000000000 R11: fffffbfff1efab4f R12: ffff888027409e40
R13: dffffc0000000000 R14: ffff88802a8a9e40 R15: ffff8880b863ab98
context_switch kernel/sched/core.c:5257 [inline]
__schedule+0x17cc/0x4d60 kernel/sched/core.c:6862
__schedule_loop kernel/sched/core.c:6944 [inline]
schedule+0x165/0x360 kernel/sched/core.c:6959
exit_to_user_mode_loop kernel/entry/common.c:31 [inline]
exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
irqentry_exit_to_user_mode+0x5d/0x110 kernel/entry/common.c:73
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697
RIP: 0033:0x7f51b1c68234
Code: 84 00 00 00 00 00 48 8b 4b 08 48 83 c3 08 48 39 d1 72 f3 48 83 e8 08 48 39 f2 73 17 66 2e 0f 1f 84 00 00 00 00 00 48 8b 70 f8 <48> 83 e8 08 48 39 f2 72 f3 48 39 c3 73 3e 48 89 33 48 83 c3 08 48
RSP: 002b:00007fffe1929780 EFLAGS: 00000283
RAX: 00007f51b1a18a78 RBX: 00007f51b18bad18 RCX: ffffffff82627962
RDX: ffffffff826251e7 RSI: ffffffff84c3f37a RDI: 00007f51b1aa19d8
RBP: 00007f51b1876ca0 R08: 00007f51b198c338 R09: 00007f51b1fd2000
R10: 00007f51b17ff008 R11: 0000000000000000 R12: 00007f51b1876c98
R13: 0000000000000021 R14: 00007fffe19298d8 R15: 00007f51b17ff008
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xb1cd9 pfn:0x62633
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 00000000000b1cd9 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 0x152c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 8656, tgid 8655 (syz.3.842), ts 221669996622, free_ts 222151364450
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3920
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5214
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2479
alloc_frozen_pages_noprof mm/mempolicy.c:2550 [inline]
alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2570
folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2580
filemap_alloc_folio_noprof+0x112/0x490 mm/filemap.c:1025
ractl_alloc_folio mm/readahead.c:189 [inline]
ra_alloc_folio mm/readahead.c:446 [inline]
page_cache_ra_order+0x55d/0xe70 mm/readahead.c:512
do_sync_mmap_readahead+0x66a/0x870 mm/filemap.c:3354
filemap_fault+0x6bc/0x12b0 mm/filemap.c:3503
__do_fault+0x138/0x390 mm/memory.c:5324
do_read_fault mm/memory.c:5751 [inline]
do_fault mm/memory.c:5885 [inline]
do_pte_missing mm/memory.c:4405 [inline]
handle_pte_fault mm/memory.c:6230 [inline]
__handle_mm_fault+0x35dc/0x5440 mm/memory.c:6372
handle_mm_fault+0x40a/0x8e0 mm/memory.c:6541
faultin_page mm/gup.c:1126 [inline]
__get_user_pages+0x1650/0x29f0 mm/gup.c:1428
populate_vma_page_range+0x29f/0x3a0 mm/gup.c:1860
__mm_populate+0x24c/0x380 mm/gup.c:1963
page last free pid 8656 tgid 8655 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
free_unref_folios+0xd22/0x1460 mm/page_alloc.c:3005
folios_put_refs+0x584/0x670 mm/swap.c:1002
folio_batch_release include/linux/pagevec.h:101 [inline]
truncate_inode_pages_range+0x346/0xda0 mm/truncate.c:385
kill_bdev block/bdev.c:91 [inline]
blkdev_flush_mapping+0x108/0x270 block/bdev.c:712
blkdev_put_whole block/bdev.c:719 [inline]
bdev_release+0x417/0x650 block/bdev.c:1144
blkdev_release+0x15/0x20 block/fops.c:709
__fput+0x44c/0xa70 fs/file_table.c:468
task_work_run+0x1d4/0x260 kernel/task_work.c:227
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0x6b5/0x2300 kernel/exit.c:966
do_group_exit+0x21c/0x2d0 kernel/exit.c:1107
get_signal+0x1285/0x1340 kernel/signal.c:3034
arch_do_signal_or_restart+0xa0/0x790 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop+0x72/0x130 kernel/entry/common.c:40
exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline]
do_syscall_64+0x2bd/0xfa0 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888062633e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888062633f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888062633f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888062634000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888062634080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: 0f 84 3c 01 00 00 je 0x142
6: 48 85 db test %rbx,%rbx
9: 0f 85 63 01 00 00 jne 0x172
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 1f 51 c5 09 call 0x9c5513f
20: e8 6a d7 36 00 call 0x36d78f
25: fb sti
26: 4c 8b 65 c0 mov -0x40(%rbp),%r12
* 2a: 49 8d bc 24 58 16 00 lea 0x1658(%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