[v5.15] KASAN: use-after-free Write in snd_usbmidi_in_urb_complete

1 view
Skip to first unread message

syzbot

unread,
Nov 1, 2025, 11:28:35 AM (yesterday) Nov 1
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cc5ec8769306 Linux 5.15.196
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15d65704580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=7280ca462ddcb7ab2368
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c71c660545b2/disk-cc5ec876.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4f011826cca6/vmlinux-cc5ec876.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8ccd1a2c3f8c/bzImage-cc5ec876.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7280ca...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in snd_usbmidi_in_urb_complete+0x31f/0x350 sound/usb/midi.c:251
Write of size 1 at addr ffff88801f19f143 by task kworker/0:2/1107

CPU: 0 PID: 1107 Comm: kworker/0:2 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Workqueue: usb_hub_wq hub_event
Call Trace:
<IRQ>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
print_address_description+0x60/0x2d0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0xdf/0x130 mm/kasan/report.c:451
snd_usbmidi_in_urb_complete+0x31f/0x350 sound/usb/midi.c:251
__usb_hcd_giveback_urb+0x35f/0x520 drivers/usb/core/hcd.c:1674
dummy_timer+0x827/0x2e10 drivers/usb/gadget/udc/dummy_hcd.c:1988
call_timer_fn+0x16c/0x530 kernel/time/timer.c:1451
expire_timers kernel/time/timer.c:1496 [inline]
__run_timers+0x525/0x7c0 kernel/time/timer.c:1767
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
handle_softirqs+0x328/0x820 kernel/softirq.c:576
__do_softirq kernel/softirq.c:610 [inline]
invoke_softirq kernel/softirq.c:450 [inline]
__irq_exit_rcu+0x12f/0x220 kernel/softirq.c:659
irq_exit_rcu+0x5/0x20 kernel/softirq.c:671
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:console_unlock+0xd90/0x1200 kernel/printk/printk.c:2749
Code: 00 48 83 7c 24 28 00 75 19 e8 4c 94 18 00 eb 18 e8 45 94 18 00 e8 10 36 4a 08 48 83 7c 24 28 00 74 e7 e8 33 94 18 00 fb 31 ff <89> de e8 89 97 18 00 85 db 0f 94 c0 22 44 24 17 3c 01 75 1f e8 17
RSP: 0018:ffffc90004436be0 EFLAGS: 00000246
RAX: ffffffff815f37dd RBX: 0000000000000000 RCX: 0000000000100000
RDX: ffffc90013b3b000 RSI: 00000000000b317f RDI: 0000000000000000
RBP: ffffc90004436e50 R08: dffffc0000000000 R09: fffffbfff1ff7c19
R10: fffffbfff1ff7c19 R11: 1ffffffff1ff7c18 R12: 1ffffffff194c7cd
R13: dffffc0000000000 R14: 0000000000000000 R15: 1ffffffff194c7c6
vprintk_emit+0xc0/0x150 kernel/printk/printk.c:2274
_printk+0xcc/0x110 kernel/printk/printk.c:2299
call_driver_probe drivers/base/dd.c:532 [inline]
really_probe+0x939/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_set_configuration+0x1991/0x1fd0 drivers/usb/core/message.c:2165
usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x139/0x270 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x284/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_new_device+0xd53/0x1640 drivers/usb/core/hub.c:2632
hub_port_connect drivers/usb/core/hub.c:5497 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
port_event drivers/usb/core/hub.c:5799 [inline]
hub_event+0x2dd9/0x5560 drivers/usb/core/hub.c:5881
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
</TASK>

Allocated by task 1107:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
__kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
kmalloc include/linux/slab.h:607 [inline]
kzalloc include/linux/slab.h:738 [inline]
snd_usbmidi_in_endpoint_create+0x7e/0xa20 sound/usb/midi.c:1342
snd_usbmidi_create_endpoints sound/usb/midi.c:1937 [inline]
__snd_usbmidi_create+0x16f8/0x2f90 sound/usb/midi.c:2659
snd_usb_create_quirk sound/usb/quirks.c:577 [inline]
create_composite_quirk+0x1ec/0x4e0 sound/usb/quirks.c:48
usb_audio_probe+0xb72/0x1d50 sound/usb/card.c:885
usb_probe_interface+0x5a0/0xaf0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x284/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_set_configuration+0x1991/0x1fd0 drivers/usb/core/message.c:2165
usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x139/0x270 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x284/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_new_device+0xd53/0x1640 drivers/usb/core/hub.c:2632
hub_port_connect drivers/usb/core/hub.c:5497 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
port_event drivers/usb/core/hub.c:5799 [inline]
hub_event+0x2dd9/0x5560 drivers/usb/core/hub.c:5881
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 1107:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1710 [inline]
slab_free_freelist_hook+0xea/0x170 mm/slub.c:1736
slab_free mm/slub.c:3504 [inline]
kfree+0xef/0x2a0 mm/slub.c:4564
snd_usbmidi_free sound/usb/midi.c:1530 [inline]
snd_usbmidi_rawmidi_free+0xaa/0x150 sound/usb/midi.c:1590
snd_rawmidi_free+0x3b7/0x3e0 sound/core/rawmidi.c:1844
snd_rawmidi_dev_free+0x34/0x40 sound/core/rawmidi.c:1853
__snd_device_free+0x1cd/0x2e0 sound/core/device.c:76
snd_device_free_all+0xcb/0x180 sound/core/device.c:233
snd_card_do_free sound/core/init.c:588 [inline]
release_card_device+0x6d/0x1f0 sound/core/init.c:145
device_release+0x92/0x1c0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:713 [inline]
kobject_release lib/kobject.c:744 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x21d/0x460 lib/kobject.c:761
snd_card_free_when_closed sound/core/init.c:620 [inline]
snd_card_free+0x123/0x190 sound/core/init.c:653
usb_audio_probe+0x187f/0x1d50 sound/usb/card.c:939
usb_probe_interface+0x5a0/0xaf0 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x284/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_set_configuration+0x1991/0x1fd0 drivers/usb/core/message.c:2165
usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238
usb_probe_device+0x139/0x270 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x284/0xc80 drivers/base/dd.c:595
__driver_probe_device+0x18c/0x330 drivers/base/dd.c:755
driver_probe_device+0x4f/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b0/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x175/0x200 drivers/base/bus.c:429
__device_attach+0x29b/0x460 drivers/base/dd.c:979
bus_probe_device+0xbc/0x1e0 drivers/base/bus.c:489
device_add+0xa00/0xfb0 drivers/base/core.c:3412
usb_new_device+0xd53/0x1640 drivers/usb/core/hub.c:2632
hub_port_connect drivers/usb/core/hub.c:5497 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5637 [inline]
port_event drivers/usb/core/hub.c:5799 [inline]
hub_event+0x2dd9/0x5560 drivers/usb/core/hub.c:5881
process_one_work+0x863/0x1000 kernel/workqueue.c:2310
worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
kthread+0x436/0x520 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88801f19f000
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 323 bytes inside of
512-byte region [ffff88801f19f000, ffff88801f19f200)
The buggy address belongs to the page:
page:ffffea00007c6700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f19c
head:ffffea00007c6700 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000200000001 ffff888016841c80
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 837, ts 8069870104, free_ts 0
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
__alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
alloc_slab_page mm/slub.c:1780 [inline]
allocate_slab mm/slub.c:1917 [inline]
new_slab+0xc0/0x4b0 mm/slub.c:1980
___slab_alloc+0x81e/0xdf0 mm/slub.c:3013
__slab_alloc mm/slub.c:3100 [inline]
slab_alloc_node mm/slub.c:3191 [inline]
slab_alloc mm/slub.c:3233 [inline]
kmem_cache_alloc_trace+0x1a5/0x2a0 mm/slub.c:3250
kmalloc include/linux/slab.h:607 [inline]
kzalloc include/linux/slab.h:738 [inline]
alloc_bprm+0x56/0x6a0 fs/exec.c:1516
kernel_execve+0x49/0x900 fs/exec.c:1978
call_usermodehelper_exec_async+0x207/0x350 kernel/umh.c:112
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
page_owner free stack trace missing

Memory state around the buggy address:
ffff88801f19f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801f19f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801f19f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801f19f180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801f19f200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 00 48 83 add %cl,-0x7d(%rax)
3: 7c 24 jl 0x29
5: 28 00 sub %al,(%rax)
7: 75 19 jne 0x22
9: e8 4c 94 18 00 call 0x18945a
e: eb 18 jmp 0x28
10: e8 45 94 18 00 call 0x18945a
15: e8 10 36 4a 08 call 0x84a362a
1a: 48 83 7c 24 28 00 cmpq $0x0,0x28(%rsp)
20: 74 e7 je 0x9
22: e8 33 94 18 00 call 0x18945a
27: fb sti
28: 31 ff xor %edi,%edi
* 2a: 89 de mov %ebx,%esi <-- trapping instruction
2c: e8 89 97 18 00 call 0x1897ba
31: 85 db test %ebx,%ebx
33: 0f 94 c0 sete %al
36: 22 44 24 17 and 0x17(%rsp),%al
3a: 3c 01 cmp $0x1,%al
3c: 75 1f jne 0x5d
3e: e8 .byte 0xe8
3f: 17 (bad)


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages