syzbot


KASAN: use-after-free Read in mcp2221_raw_event

Status: upstream: reported on 2025/06/21 10:55
Reported-by: syzbot+d75a9642ae95591bbc5b@syzkaller.appspotmail.com
First crash: 167d, last: 10d
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in mcp2221_raw_event input usb 19 C 1144 57d 363d 29/29 fixed on 2025/10/09 01:15
upstream KASAN: slab-out-of-bounds Read in mcp2221_raw_event (2) input usb 19 C error 209 4h49m 53d 0/29 upstream: reported C repro on 2025/10/13 04:00

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0x1062/0x1240 drivers/hid/hid-mcp2221.c:856
Read of size 1 at addr ffff888079633fff by task syz.1.335/6748

CPU: 0 PID: 6748 Comm: syz.1.335 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <IRQ>
 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
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:687
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa9/0x110 kernel/locking/spinlock.c:194
Code: 74 05 e8 aa 1b 13 f7 48 c7 44 24 20 00 00 00 00 9c 8f 44 24 20 f6 44 24 21 02 75 4b f7 c3 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> c2 96 e2 f6 65 8b 05 b3 cd 8a 75 85 c0 74 3c 48 c7 04 24 0e 36
RSP: 0018:ffffc900033d7ca0 EFLAGS: 00000206
RAX: bef691a8bfc5d300 RBX: 0000000000000a06 RCX: bef691a8bfc5d300
RDX: dffffc0000000000 RSI: ffffffff8aaabce0 RDI: 0000000000000001
RBP: ffffc900033d7d30 R08: ffffffff8e4a8e2f R09: 1ffffffff1c951c5
R10: dffffc0000000000 R11: fffffbfff1c951c6 R12: dffffc0000000000
R13: ffffc900033d7d80 R14: ffffffff971716b8 R15: 1ffff9200067af94
 hrtimer_init_sleeper_on_stack kernel/time/hrtimer.c:475 [inline]
 hrtimer_nanosleep+0xac/0x350 kernel/time/hrtimer.c:2137
 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1397 [inline]
 __se_sys_clock_nanosleep+0x2ea/0x370 kernel/time/posix-timers.c:1374
 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
RIP: 0033:0x7f8f987c2005
Code: 24 0c 89 3c 24 48 89 4c 24 18 e8 f6 54 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 8b 74 24 0c 8b 3c 24 b8 e6 00 00 00 0f 05 <44> 89 c7 48 89 04 24 e8 4f 55 ff ff 48 8b 04 24 48 83 c4 28 f7 d8
RSP: 002b:00007f8f996fff60 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f8f987c2005
RDX: 00007f8f996fffa0 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 00002000000001c0
R13: 0000000000000000 R14: 00007f8f989e5fa0 R15: 00007fff22f54b88
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001e58cc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x79633
memcg:ffff88802f242402
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xfffffdff(table)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 ffff88802e35cd20 00000001fffffdff ffff88802f242402
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x540dc0(GFP_USER|__GFP_COMP|__GFP_ZERO|__GFP_ACCOUNT), pid 5788, tgid 5788 (syz-executor), ts 154101668677, free_ts 153962044827
 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
 pagetable_alloc include/linux/mm.h:2900 [inline]
 __pte_alloc_one include/asm-generic/pgalloc.h:68 [inline]
 pte_alloc_one+0x89/0x540 arch/x86/mm/pgtable.c:33
 __pte_alloc+0x22/0x2a0 mm/memory.c:438
 copy_pte_range mm/memory.c:1029 [inline]
 copy_pmd_range mm/memory.c:1168 [inline]
 copy_pud_range mm/memory.c:1205 [inline]
 copy_p4d_range mm/memory.c:1229 [inline]
 copy_page_range+0x2d72/0x3600 mm/memory.c:1323
 dup_mmap kernel/fork.c:764 [inline]
 dup_mm kernel/fork.c:1692 [inline]
 copy_mm+0x11a8/0x1ca0 kernel/fork.c:1741
 copy_process+0x16d3/0x3d70 kernel/fork.c:2506
 kernel_clone+0x21b/0x840 kernel/fork.c:2914
 __do_sys_clone kernel/fork.c:3057 [inline]
 __se_sys_clone kernel/fork.c:3041 [inline]
 __x64_sys_clone+0x18c/0x1e0 kernel/fork.c:3041
 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_list+0xbe/0x860 mm/page_alloc.c:2475
 release_pages+0x1fa0/0x2220 mm/swap.c:1022
 tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
 tlb_flush_mmu+0x368/0x4f0 mm/mmu_gather.c:300
 tlb_finish_mmu+0xc3/0x1d0 mm/mmu_gather.c:392
 exit_mmap+0x3f0/0xb50 mm/mmap.c:3315
 __mmput+0x118/0x3c0 kernel/fork.c:1355
 exit_mm+0x1da/0x2c0 kernel/exit.c:569
 do_exit+0x88e/0x23c0 kernel/exit.c:870
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
 __do_sys_exit_group kernel/exit.c:1035 [inline]
 __se_sys_exit_group kernel/exit.c:1033 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
 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:
 ffff888079633e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888079633f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888079633f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                                ^
 ffff888079634000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888079634080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
   0:	74 05                	je     0x7
   2:	e8 aa 1b 13 f7       	call   0xf7131bb1
   7:	48 c7 44 24 20 00 00 	movq   $0x0,0x20(%rsp)
   e:	00 00
  10:	9c                   	pushf
  11:	8f 44 24 20          	pop    0x20(%rsp)
  15:	f6 44 24 21 02       	testb  $0x2,0x21(%rsp)
  1a:	75 4b                	jne    0x67
  1c:	f7 c3 00 02 00 00    	test   $0x200,%ebx
  22:	74 01                	je     0x25
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 c2 96 e2 f6       	call   0xf6e296f1 <-- trapping instruction
  2f:	65 8b 05 b3 cd 8a 75 	mov    %gs:0x758acdb3(%rip),%eax        # 0x758acde9
  36:	85 c0                	test   %eax,%eax
  38:	74 3c                	je     0x76
  3a:	48                   	rex.W
  3b:	c7                   	.byte 0xc7
  3c:	04 24                	add    $0x24,%al
  3e:	0e                   	(bad)
  3f:	36                   	ss

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/11/24 14:45 linux-6.6.y 1e89a1be4fe9 bf6fe8fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in mcp2221_raw_event
2025/11/20 12:21 linux-6.6.y 0a805b6ea8cd 2cc4c24a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in mcp2221_raw_event
2025/11/17 01:05 linux-6.6.y 0a805b6ea8cd f7988ea4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in mcp2221_raw_event
2025/07/16 11:31 linux-6.6.y 9247f4e6573a 124ec9cc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in mcp2221_raw_event
2025/06/21 10:54 linux-6.6.y 6282921b6825 d6cdfb8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in mcp2221_raw_event
2025/11/24 14:44 linux-6.6.y 1e89a1be4fe9 bf6fe8fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/11/19 08:19 linux-6.6.y 0a805b6ea8cd ef766cd7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/11/17 01:05 linux-6.6.y 0a805b6ea8cd f7988ea4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/11/12 03:11 linux-6.6.y 0a805b6ea8cd 4e1406b4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/10/27 07:33 linux-6.6.y 4a243110dc88 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/10/13 21:53 linux-6.6.y 655054d2c3c1 b6605ba8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/07/15 00:55 linux-6.6.y 9247f4e6573a d8fc7335 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/07/10 06:21 linux-6.6.y a5df3a702b2c 956bd956 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/07/02 07:14 linux-6.6.y 3f5b4c104b7d bc80e4f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
2025/06/27 05:42 linux-6.6.y 6282921b6825 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in mcp2221_raw_event
* Struck through repros no longer work on HEAD.