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: 152d, last: 17h37m
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 43d 349d 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 144 12h10m 39d 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 ffff88805d637fff by task udevd/5798

CPU: 0 PID: 5798 Comm: udevd 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:__mnt_drop_write fs/namespace.c:476 [inline]
RIP: 0010:mnt_drop_write+0x47/0xa0 fs/namespace.c:489
Code: 01 00 00 00 e8 0a 71 67 ff 4c 8d 73 30 4c 89 f0 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 f7 e8 a0 ee e8 ff 49 8b 06 65 ff 48 04 <bf> 01 00 00 00 e8 7f 72 67 ff 65 8b 2d 70 bb 0f 7e 31 ff 89 ee e8
RSP: 0018:ffffc900045ffdd8 EFLAGS: 00000296
RAX: 0000607f46e20c04 RBX: ffff88814226d520 RCX: ffffffff96eaf400
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff81f3fc26
RBP: ffffc900045fff00 R08: ffff88802bf9e767 R09: 1ffff110057f3cec
R10: dffffc0000000000 R11: ffffed10057f3ced R12: ffffc900045ffe80
R13: dffffc0000000000 R14: ffff88814226d550 R15: dffffc0000000000
 do_unlinkat+0x4c0/0x570 fs/namei.c:4413
 __do_sys_unlink fs/namei.c:4447 [inline]
 __se_sys_unlink fs/namei.c:4445 [inline]
 __x64_sys_unlink+0x49/0x50 fs/namei.c:4445
 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:0x7f0da5f15937
Code: 00 00 e9 a9 fd ff ff 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 5f 00 00 00 0f 05 c3 0f 1f 84 00 00 00 00 00 b8 57 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 91 b4 0d 00 f7 d8 64 89 02 b8
RSP: 002b:00007ffc0c7f0e18 EFLAGS: 00000202 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 00007ffc0c7f0e20 RCX: 00007f0da5f15937
RDX: 0000000000000000 RSI: 00000000000003dc RDI: 00007ffc0c7f0e20
RBP: 000055566d33f320 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000aba9500
R13: 0000000003938700 R14: 000055565e18c100 R15: 000055565e18c140
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001758dc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x5d637
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000001 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 5794, tgid 5794 (syz-executor), ts 88184026263, free_ts 97477468711
 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+0x1ea/0x330 mm/slub.c:3540
 kmalloc_reserve+0x95/0x260 net/core/skbuff.c:559
 __alloc_skb+0x138/0x2c0 net/core/skbuff.c:650
 alloc_skb include/linux/skbuff.h:1284 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1184 [inline]
 netlink_sendmsg+0x65b/0xbe0 net/netlink/af_netlink.c:1869
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 __sys_sendto+0x46a/0x620 net/socket.c:2201
 __do_sys_sendto net/socket.c:2213 [inline]
 __se_sys_sendto net/socket.c:2209 [inline]
 __x64_sys_sendto+0xde/0xf0 net/socket.c:2209
 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
 __slab_free+0x35e/0x410 mm/slub.c:3736
 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
 vm_area_alloc+0x24/0x1d0 kernel/fork.c:486
 __mmap_region mm/mmap.c:2770 [inline]
 mmap_region+0xc8a/0x2020 mm/mmap.c:2941
 do_mmap+0x92f/0x10a0 mm/mmap.c:1385
 vm_mmap_pgoff+0x1c0/0x400 mm/util.c:556
 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:
 ffff88805d637e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88805d637f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88805d637f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                                ^
 ffff88805d638000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805d638080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
   0:	01 00                	add    %eax,(%rax)
   2:	00 00                	add    %al,(%rax)
   4:	e8 0a 71 67 ff       	call   0xff677113
   9:	4c 8d 73 30          	lea    0x30(%rbx),%r14
   d:	4c 89 f0             	mov    %r14,%rax
  10:	48 c1 e8 03          	shr    $0x3,%rax
  14:	42 80 3c 38 00       	cmpb   $0x0,(%rax,%r15,1)
  19:	74 08                	je     0x23
  1b:	4c 89 f7             	mov    %r14,%rdi
  1e:	e8 a0 ee e8 ff       	call   0xffe8eec3
  23:	49 8b 06             	mov    (%r14),%rax
  26:	65 ff 48 04          	decl   %gs:0x4(%rax)
* 2a:	bf 01 00 00 00       	mov    $0x1,%edi <-- trapping instruction
  2f:	e8 7f 72 67 ff       	call   0xff6772b3
  34:	65 8b 2d 70 bb 0f 7e 	mov    %gs:0x7e0fbb70(%rip),%ebp        # 0x7e0fbbab
  3b:	31 ff                	xor    %edi,%edi
  3d:	89 ee                	mov    %ebp,%esi
  3f:	e8                   	.byte 0xe8

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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.