==================================================================
BUG: KASAN: use-after-free in mcp2221_raw_event+0xf94/0x1030 drivers/hid/hid-mcp2221.c:854
Read of size 1 at addr ffff88805c903fff by task syz.0.1470/9755
CPU: 1 UID: 0 PID: 9755 Comm: syz.0.1470 Not tainted 6.16.0-rc6-syzkaller-00002-g155a3c003e55 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xcd/0x610 mm/kasan/report.c:480
kasan_report+0xe0/0x110 mm/kasan/report.c:593
mcp2221_raw_event+0xf94/0x1030 drivers/hid/hid-mcp2221.c:854
__hid_input_report.constprop.0+0x311/0x450 drivers/hid/hid-core.c:2117
hid_irq_in+0x35e/0x870 drivers/hid/usbhid/hid-core.c:286
__usb_hcd_giveback_urb+0x38d/0x6e0 drivers/usb/core/hcd.c:1650
usb_hcd_giveback_urb+0x39b/0x450 drivers/usb/core/hcd.c:1734
dummy_timer+0x180e/0x3a20 drivers/usb/gadget/udc/dummy_hcd.c:1995
__run_hrtimer kernel/time/hrtimer.c:1761 [inline]
__hrtimer_run_queues+0x1ff/0xad0 kernel/time/hrtimer.c:1825
hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1842
handle_softirqs+0x219/0x8e0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0x109/0x170 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194
Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 d6 8c 0d f6 48 89 df e8 be e0 0d f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 e5 02 fe f5 65 8b 05 7e d9 45 08 85 c0 74 16 5b
RSP: 0018:ffffc9000c84fb30 EFLAGS: 00000246
RAX: 0000000000000002 RBX: ffff88805c5fbc58 RCX: ffffffff81c3c22f
RDX: 0000000000000000 RSI: ffffffff8de32e47 RDI: ffffffff8c158f60
RBP: 0000000000000292 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff90a98757 R11: 0000000000000001 R12: ffff88801ffa4880
R13: 0000000000000bb8 R14: ffff88805c5fbc58 R15: ffff888034241500
snd_rawmidi_write+0x4a4/0xc10 sound/core/rawmidi.c:1617
do_loop_readv_writev fs/read_write.c:850 [inline]
do_loop_readv_writev fs/read_write.c:835 [inline]
vfs_writev+0x5df/0xde0 fs/read_write.c:1059
do_writev+0x28c/0x340 fs/read_write.c:1103
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fcb4898e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcb4975a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007fcb48bb5fa0 RCX: 00007fcb4898e929
RDX: 0000000000000002 RSI: 0000200000000840 RDI: 0000000000000006
RBP: 00007fcb48a10b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fcb48bb5fa0 R15: 00007ffeed29ef08
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5c903
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 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 9421, tgid 9404 (syz.0.1349), ts 230404437986, free_ts 250235441709
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1704
prep_new_page mm/page_alloc.c:1712 [inline]
get_page_from_freelist+0x1321/0x3890 mm/page_alloc.c:3669
__alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:4959
alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2419
alloc_slab_page mm/slub.c:2451 [inline]
allocate_slab mm/slub.c:2619 [inline]
new_slab+0x23b/0x330 mm/slub.c:2673
___slab_alloc+0xd9c/0x1940 mm/slub.c:3859
__slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3949
__slab_alloc_node mm/slub.c:4024 [inline]
slab_alloc_node mm/slub.c:4185 [inline]
kmem_cache_alloc_node_noprof+0xf5/0x3b0 mm/slub.c:4249
kmalloc_reserve+0x18b/0x2c0 net/core/skbuff.c:579
__alloc_skb+0x166/0x380 net/core/skbuff.c:670
alloc_skb include/linux/skbuff.h:1336 [inline]
alloc_skb_with_frags+0xe0/0x860 net/core/skbuff.c:6665
sock_alloc_send_pskb+0x7fb/0x990 net/core/sock.c:2999
sock_alloc_send_skb include/net/sock.h:1847 [inline]
__ip_append_data+0x21c6/0x4240 net/ipv4/ip_output.c:1120
ip_make_skb+0x27f/0x300 net/ipv4/ip_output.c:1568
udp_sendmsg+0x18b4/0x29f0 net/ipv4/udp.c:1480
inet_sendmsg+0x105/0x140 net/ipv4/af_inet.c:851
page last free pid 5903 tgid 5903 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1248 [inline]
__free_frozen_pages+0x7fe/0x1180 mm/page_alloc.c:2706
discard_slab mm/slub.c:2717 [inline]
__put_partials+0x16d/0x1c0 mm/slub.c:3186
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x4d/0x120 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4148 [inline]
slab_alloc_node mm/slub.c:4197 [inline]
__kmalloc_cache_noprof+0x1f1/0x3e0 mm/slub.c:4354
kmalloc_noprof include/linux/slab.h:905 [inline]
usb_control_msg+0xbc/0x4a0 drivers/usb/core/message.c:144
get_port_status drivers/usb/core/hub.c:611 [inline]
hub_ext_port_status+0x14e/0x670 drivers/usb/core/hub.c:628
usb_hub_port_status drivers/usb/core/hub.c:678 [inline]
hub_port_wait_reset drivers/usb/core/hub.c:2973 [inline]
hub_port_reset+0xad2/0x1cb0 drivers/usb/core/hub.c:3092
hub_port_init+0x1f6/0x3a70 drivers/usb/core/hub.c:4938
hub_port_connect drivers/usb/core/hub.c:5495 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5706 [inline]
port_event drivers/usb/core/hub.c:5866 [inline]
hub_event+0x2c67/0x4fa0 drivers/usb/core/hub.c:5948
process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3238
process_scheduled_works kernel/workqueue.c:3321 [inline]
worker_thread+0x6c8/0xf10 kernel/workqueue.c:3402
kthread+0x3c5/0x780 kernel/kthread.c:464
ret_from_fork+0x5d7/0x6f0 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Memory state around the buggy address:
ffff88805c903e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88805c903f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88805c903f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88805c904000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88805c904080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
----------------
Code disassembly (best guess):
0: f5 cmc
1: 53 push %rbx
2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi
7: 48 89 fb mov %rdi,%rbx
a: 48 83 c7 18 add $0x18,%rdi
e: e8 d6 8c 0d f6 call 0xf60d8ce9
13: 48 89 df mov %rbx,%rdi
16: e8 be e0 0d f6 call 0xf60de0d9
1b: f7 c5 00 02 00 00 test $0x200,%ebp
21: 75 23 jne 0x46
23: 9c pushf
24: 58 pop %rax
25: f6 c4 02 test $0x2,%ah
28: 75 37 jne 0x61
* 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction
2f: e8 e5 02 fe f5 call 0xf5fe0319
34: 65 8b 05 7e d9 45 08 mov %gs:0x845d97e(%rip),%eax # 0x845d9b9
3b: 85 c0 test %eax,%eax
3d: 74 16 je 0x55
3f: 5b pop %rbx