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

0 views
Skip to first unread message

syzbot

unread,
3:30 AM (3 hours ago) 3:30 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ef251c45f1cd Linux 5.15.204
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1507516a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=353ae28c40b35af5
dashboard link: https://syzkaller.appspot.com/bug?extid=32707efde7da1a2c6b31
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/bde897c3d01f/disk-ef251c45.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/51b2a5826cd1/vmlinux-ef251c45.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cb95a5a40121/bzImage-ef251c45.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+32707e...@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 ffff88805fc4b543 by task syz.1.1264/7019

CPU: 0 PID: 7019 Comm: syz.1.1264 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
<IRQ>
dump_stack_lvl+0x188/0x250 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+0x17b/0x540 kernel/time/timer.c:1648
expire_timers kernel/time/timer.c:1699 [inline]
__run_timers+0x53e/0x800 kernel/time/timer.c:1970
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1983
handle_softirqs+0x339/0x830 kernel/softirq.c:576
__do_softirq kernel/softirq.c:610 [inline]
invoke_softirq kernel/softirq.c:450 [inline]
__irq_exit_rcu+0x13b/0x230 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_next_entry+0x1e3/0x3d0 include/linux/xarray.h:1656
Code: 7c 1e 08 41 89 c6 31 ff 89 c6 e8 c8 e4 da ff 45 85 f6 74 29 49 83 c7 18 4c 89 ff be ff ff ff ff e8 d2 78 1e 08 41 89 c6 31 ff <89> c6 e8 a6 e4 da ff 45 85 f6 74 0e e8 3c e1 da ff eb 22 e8 35 e1
RSP: 0000:ffffc900044bfad8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 9d9f869aa8072700
RDX: 0000000000000000 RSI: ffffffff8a2b3aa0 RDI: 0000000000000000
RBP: ffffea00019e5400 R08: ffffea00019e53c7 R09: 1ffffd400033ca78
R10: dffffc0000000000 R11: fffff9400033ca79 R12: 1ffff92000897f81
R13: ffffc900044bfc08 R14: 0000000000000000 R15: ffff8880740b4ab0
next_map_page mm/filemap.c:3296 [inline]
filemap_map_pages+0xecd/0x13b0 mm/filemap.c:3352
do_fault_around mm/memory.c:4243 [inline]
do_read_fault mm/memory.c:4258 [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+0x25bc/0x4410 mm/memory.c:4883
do_user_addr_fault+0x489/0xc80 arch/x86/mm/fault.c:1355
handle_page_fault arch/x86/mm/fault.c:1443 [inline]
exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1496
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
RIP: 0033:0x7f30887176d6
Code: ff 48 83 e8 01 48 89 de bf 01 00 00 00 48 c1 e0 0e 48 c1 ee 06 48 01 c8 48 89 d9 81 e6 ff 3f 00 00 48 c1 e9 03 83 e1 07 d3 e7 <40> 84 bc 06 20 20 00 00 0f 85 20 fe ff ff e9 d4 fd ff ff 0f 1f 80
RSP: 002b:00007ffffd9f2470 EFLAGS: 00010202
RAX: 000000110c260000 RBX: ffffffff83e306aa RCX: 0000000000000005
RDX: 00000000000006aa RSI: 0000000000000c1a RDI: 0000000000000020
RBP: 0000000000000000 R08: 00007f3088aa6000 R09: 00007f3088aa8000
R10: 0000000083e306ae R11: 0000000000000000 R12: 00007f3088abc038
R13: 00000000000000f0 R14: ffffffff83e30917 R15: 00007f30895eb720
</TASK>

Allocated by task 4201:
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_midiman sound/usb/midi.c:2377 [inline]
__snd_usbmidi_create+0x20ba/0x3040 sound/usb/midi.c:2657
usb_audio_probe+0xb97/0x1d90 sound/usb/card.c:885
usb_probe_interface+0x5c5/0xb20 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+0x184/0x210 drivers/base/bus.c:429
__device_attach+0x2a8/0x480 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:2223
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+0x184/0x210 drivers/base/bus.c:429
__device_attach+0x2a8/0x480 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+0xd65/0x1660 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+0x2e4a/0x55e0 drivers/usb/core/hub.c:5881
process_one_work+0x85f/0x1010 kernel/workqueue.c:2310
worker_thread+0xaa6/0x1290 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 4201:
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+0x14b/0x1e0 sound/core/init.c:653
usb_audio_probe+0x18bd/0x1d90 sound/usb/card.c:939
usb_probe_interface+0x5c5/0xb20 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+0x184/0x210 drivers/base/bus.c:429
__device_attach+0x2a8/0x480 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:2223
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+0x184/0x210 drivers/base/bus.c:429
__device_attach+0x2a8/0x480 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+0xd65/0x1660 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+0x2e4a/0x55e0 drivers/usb/core/hub.c:5881
process_one_work+0x85f/0x1010 kernel/workqueue.c:2310
worker_thread+0xaa6/0x1290 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 ffff88805fc4b400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 323 bytes inside of
512-byte region [ffff88805fc4b400, ffff88805fc4b600)
The buggy address belongs to the page:
page:ffffea00017f1200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5fc48
head:ffffea00017f1200 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016c41c80
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 4192, ts 70789733947, free_ts 22002976637
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x1bbd/0x1ca0 mm/page_alloc.c:4192
__alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
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+0x80a/0xdd0 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]
__kmalloc+0x1cd/0x330 mm/slub.c:4408
kmalloc include/linux/slab.h:612 [inline]
kzalloc include/linux/slab.h:738 [inline]
fib6_info_alloc+0x2e/0xe0 net/ipv6/ip6_fib.c:155
ip6_route_info_create+0x44f/0x1210 net/ipv6/route.c:3768
addrconf_f6i_alloc+0x1ec/0x430 net/ipv6/route.c:4591
ipv6_add_addr+0x45f/0xe10 net/ipv6/addrconf.c:1123
inet6_addr_add+0x43a/0x9c0 net/ipv6/addrconf.c:2998
inet6_rtm_newaddr+0x64c/0x8f0 net/ipv6/addrconf.c:4951
rtnetlink_rcv_msg+0x844/0xf30 net/core/rtnetlink.c:5687
netlink_rcv_skb+0x1f5/0x440 net/netlink/af_netlink.c:2507
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x774/0x920 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ba/0xbe0 net/netlink/af_netlink.c:1918
sock_sendmsg_nosec net/socket.c:706 [inline]
__sock_sendmsg net/socket.c:718 [inline]
__sys_sendto+0x46d/0x620 net/socket.c:2072
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396
free_contig_range+0x96/0xf0 mm/page_alloc.c:9428
destroy_args+0xf0/0xa00 mm/debug_vm_pgtable.c:1018
debug_vm_pgtable+0x321/0x380 mm/debug_vm_pgtable.c:1336
do_one_initcall+0x272/0x730 init/main.c:1316
do_initcall_level+0x137/0x1f0 init/main.c:1389
do_initcalls+0x4b/0x90 init/main.c:1405
kernel_init_freeable+0x3e9/0x570 init/main.c:1629
kernel_init+0x19/0x1b0 init/main.c:1520
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
ffff88805fc4b400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805fc4b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805fc4b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88805fc4b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805fc4b600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess), 3 bytes skipped:
0: 41 89 c6 mov %eax,%r14d
3: 31 ff xor %edi,%edi
5: 89 c6 mov %eax,%esi
7: e8 c8 e4 da ff call 0xffdae4d4
c: 45 85 f6 test %r14d,%r14d
f: 74 29 je 0x3a
11: 49 83 c7 18 add $0x18,%r15
15: 4c 89 ff mov %r15,%rdi
18: be ff ff ff ff mov $0xffffffff,%esi
1d: e8 d2 78 1e 08 call 0x81e78f4
22: 41 89 c6 mov %eax,%r14d
25: 31 ff xor %edi,%edi
* 27: 89 c6 mov %eax,%esi <-- trapping instruction
29: e8 a6 e4 da ff call 0xffdae4d4
2e: 45 85 f6 test %r14d,%r14d
31: 74 0e je 0x41
33: e8 3c e1 da ff call 0xffdae174
38: eb 22 jmp 0x5c
3a: e8 .byte 0xe8
3b: 35 .byte 0x35
3c: e1 .byte 0xe1


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