[v5.15] KASAN: use-after-free Read in snd_usbmidi_error_timer

0 views
Skip to first unread message

syzbot

unread,
1:28 PM (4 hours ago) 1:28 PM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 68efe5a6c16a Linux 5.15.197
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11050592580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7e6ed99963d6ee1d
dashboard link: https://syzkaller.appspot.com/bug?extid=cecb8ef5804e559b2b52
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/900f9b9bd850/disk-68efe5a6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1e089a5019a6/vmlinux-68efe5a6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b319f477b907/bzImage-68efe5a6.xz

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

==================================================================
BUG: KASAN: use-after-free in snd_usbmidi_error_timer+0x5fe/0x660 sound/usb/midi.c:352
Read of size 1 at addr ffff8880236b1943 by task syz.3.22/4401

CPU: 1 PID: 4401 Comm: syz.3.22 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
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_error_timer+0x5fe/0x660 sound/usb/midi.c:352
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:xa_entry include/linux/xarray.h:1197 [inline]
RIP: 0010:xas_descend+0xc5/0x3b0 lib/xarray.c:204
Code: 0c 24 4c 8d 74 c1 28 4c 89 f0 48 c1 e8 03 80 3c 28 00 74 08 4c 89 f7 e8 d9 b3 bc fd 4d 8b 36 e8 21 6c a2 05 89 c5 31 ff 89 c6 <e8> 86 4e 78 fd 85 ed 74 27 49 83 c5 18 4c 89 ef be ff ff ff ff e8
RSP: 0018:ffffc90003a0f450 EFLAGS: 00000246
RAX: 0000000000000001 RBX: 1ffff92000741ea8 RCX: ffff88802add9dc0
RDX: ffffc90004485000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000001 R08: dffffc0000000000 R09: fffffbfff1ff5419
R10: fffffbfff1ff5419 R11: 1ffffffff1ff5418 R12: ffffc90003a0f540
R13: ffff888024f8aee0 R14: 0000000000000000 R15: 00000000000007e2
xas_load+0xba/0x140 lib/xarray.c:240
mapping_get_entry mm/filemap.c:1826 [inline]
pagecache_get_page+0x19d/0xef0 mm/filemap.c:1894
shmem_getpage_gfp+0x305/0x2d40 mm/shmem.c:1841
shmem_fault+0x1a9/0x520 mm/shmem.c:2118
__do_fault+0x141/0x330 mm/memory.c:3928
do_read_fault mm/memory.c:4264 [inline]
do_fault mm/memory.c:4392 [inline]
handle_pte_fault mm/memory.c:4650 [inline]
__handle_mm_fault mm/memory.c:4785 [inline]
handle_mm_fault+0x2946/0x43b0 mm/memory.c:4883
faultin_page mm/gup.c:976 [inline]
__get_user_pages+0x93e/0x11c0 mm/gup.c:1197
populate_vma_page_range+0x213/0x290 mm/gup.c:1529
__mm_populate+0x26f/0x3a0 mm/gup.c:1638
mm_populate include/linux/mm.h:2646 [inline]
vm_mmap_pgoff+0x203/0x2b0 mm/util.c:556
ksys_mmap_pgoff+0x140/0x780 mm/mmap.c:1635
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f52d40b1749
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:00007f52d2318038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007f52d4307fa0 RCX: 00007f52d40b1749
RDX: b635773f06ebbeee RSI: 0000000000b36000 RDI: 0000200000000000
RBP: 00007f52d4135f91 R08: ffffffffffffffff R09: 0000000032cc0000
R10: 0000000000008031 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f52d4308038 R14: 00007f52d4307fa0 R15: 00007fff08522378
</TASK>

Allocated by task 4250:
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 4250:
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 ffff8880236b1800
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 323 bytes inside of
512-byte region [ffff8880236b1800, ffff8880236b1a00)
The buggy address belongs to the page:
page:ffffea00008dac00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880236b3000 pfn:0x236b0
head:ffffea00008dac00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea00017e0908 ffffea00017e1708 ffff888016841c80
raw: ffff8880236b3000 000000000010000d 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 1315, ts 9252717807, 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:
ffff8880236b1800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880236b1880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880236b1900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880236b1980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880236b1a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 0c 24 or $0x24,%al
2: 4c 8d 74 c1 28 lea 0x28(%rcx,%rax,8),%r14
7: 4c 89 f0 mov %r14,%rax
a: 48 c1 e8 03 shr $0x3,%rax
e: 80 3c 28 00 cmpb $0x0,(%rax,%rbp,1)
12: 74 08 je 0x1c
14: 4c 89 f7 mov %r14,%rdi
17: e8 d9 b3 bc fd call 0xfdbcb3f5
1c: 4d 8b 36 mov (%r14),%r14
1f: e8 21 6c a2 05 call 0x5a26c45
24: 89 c5 mov %eax,%ebp
26: 31 ff xor %edi,%edi
28: 89 c6 mov %eax,%esi
* 2a: e8 86 4e 78 fd call 0xfd784eb5 <-- trapping instruction
2f: 85 ed test %ebp,%ebp
31: 74 27 je 0x5a
33: 49 83 c5 18 add $0x18,%r13
37: 4c 89 ef mov %r13,%rdi
3a: be ff ff ff ff mov $0xffffffff,%esi
3f: e8 .byte 0xe8


---
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