==================================================================
BUG: KASAN: use-after-free in __snd_rawmidi_transmit_peek+0x261/0x360 sound/core/rawmidi.c:1286
Read of size 1 at addr ffff88807375a05d by task swapper/2/0
CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.19.0-rc6-syzkaller-00115-g4a57a8400075 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
__snd_rawmidi_transmit_peek+0x261/0x360 sound/core/rawmidi.c:1286
snd_rawmidi_transmit+0x8d/0xf0 sound/core/rawmidi.c:1411
snd_usbmidi_standard_output+0x264/0xc10 sound/usb/midi.c:650
snd_usbmidi_do_output+0x200/0x510 sound/usb/midi.c:311
snd_usbmidi_error_timer+0x128/0x390 sound/usb/midi.c:362
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1474
expire_timers kernel/time/timer.c:1519 [inline]
__run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1790
__run_timers kernel/time/timer.c:1768 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803
__do_softirq+0x29b/0x9c2 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:default_idle+0xb/0x10 arch/x86/kernel/process.c:731
Code: ff ff ff 48 89 df e8 f4 c2 4c f8 e9 55 ff ff ff 4c 89 e7 e8 e7 c2 4c f8 eb 96 0f 1f 44 00 00 66 90 0f 00 2d 27 52 4c 00 fb f4 cc cc cc cc 41 55 41 54 55 48 89 fd 53 e8 12 07 00 f8 e8 9d 11
RSP: 0018:ffffc9000046fe00 EFLAGS: 00000242
RAX: 00000000002caf01 RBX: ffff888012140000 RCX: ffffffff89776b01
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 0000000000000002 R08: 0000000000000001 R09: ffff88802ca3aed3
R10: ffffed10059475da R11: 0000000000000001 R12: ffffed1002428000
R13: 0000000000000002 R14: ffffffff8dbbaf90 R15: 0000000000000000
default_idle_call+0x80/0xc0 kernel/sched/idle.c:109
cpuidle_idle_call kernel/sched/idle.c:191 [inline]
do_idle+0x401/0x590 kernel/sched/idle.c:303
cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:400
start_secondary+0x21d/0x2b0 arch/x86/kernel/smpboot.c:266
secondary_startup_64_no_verify+0xce/0xdb
Allocated by task 8703:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:436 [inline]
____kasan_kmalloc mm/kasan/common.c:515 [inline]
____kasan_kmalloc mm/kasan/common.c:474 [inline]
__kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524
kmalloc_node include/linux/slab.h:623 [inline]
kvmalloc_node+0x3e/0x190 mm/util.c:613
kvmalloc include/linux/slab.h:750 [inline]
kvzalloc include/linux/slab.h:758 [inline]
snd_rawmidi_runtime_create sound/core/rawmidi.c:162 [inline]
open_substream+0x340/0x8b0 sound/core/rawmidi.c:306
rawmidi_open_priv+0x591/0x6f0 sound/core/rawmidi.c:357
snd_rawmidi_kernel_open+0x1b5/0x270 sound/core/rawmidi.c:392
midisynth_use+0xee/0x270 sound/core/seq/seq_midi.c:215
subscribe_port sound/core/seq/seq_ports.c:412 [inline]
check_and_subscribe_port+0x89a/0xb80 sound/core/seq/seq_ports.c:495
snd_seq_port_connect+0x382/0x540 sound/core/seq/seq_ports.c:581
snd_seq_ioctl_subscribe_port+0x1fc/0x400 sound/core/seq/seq_clientmgr.c:1492
snd_seq_kernel_client_ctl+0x102/0x1e0 sound/core/seq/seq_clientmgr.c:2369
snd_seq_oss_midi_open+0x582/0x6e0 sound/core/seq/oss/seq_oss_midi.c:359
snd_seq_oss_synth_setup_midi+0x12d/0x530 sound/core/seq/oss/seq_oss_synth.c:269
snd_seq_oss_open+0x8c3/0xa80 sound/core/seq/oss/seq_oss_init.c:260
odev_open+0x6c/0x90 sound/core/seq/oss/seq_oss.c:128
soundcore_open+0x44e/0x620 sound/sound_core.c:593
chrdev_open+0x266/0x770 fs/char_dev.c:414
do_dentry_open+0x4a1/0x11f0 fs/open.c:848
do_open fs/namei.c:3520 [inline]
path_openat+0x1c71/0x2910 fs/namei.c:3653
do_filp_open+0x1aa/0x400 fs/namei.c:3680
do_sys_openat2+0x16d/0x4c0 fs/open.c:1278
do_sys_open fs/open.c:1294 [inline]
__do_compat_sys_openat fs/open.c:1354 [inline]
__se_compat_sys_openat fs/open.c:1352 [inline]
__ia32_compat_sys_openat+0x13f/0x1f0 fs/open.c:1352
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82
Freed by task 8703:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track+0x21/0x30 mm/kasan/common.c:45
kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
____kasan_slab_free mm/kasan/common.c:366 [inline]
____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328
kasan_slab_free include/linux/kasan.h:200 [inline]
slab_free_hook mm/slub.c:1754 [inline]
slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780
slab_free mm/slub.c:3536 [inline]
kfree+0xd6/0x4d0 mm/slub.c:4584
kvfree+0x42/0x50 mm/util.c:655
snd_rawmidi_runtime_free sound/core/rawmidi.c:176 [inline]
close_substream.part.0+0x185/0x720 sound/core/rawmidi.c:528
close_substream sound/core/rawmidi.c:507 [inline]
rawmidi_release_priv+0x192/0x270 sound/core/rawmidi.c:547
snd_rawmidi_kernel_release+0x39/0xd0 sound/core/rawmidi.c:564
midisynth_unuse+0x45/0x80 sound/core/seq/seq_midi.c:244
unsubscribe_port sound/core/seq/seq_ports.c:437 [inline]
__delete_and_unsubscribe_port+0x270/0x4c0 sound/core/seq/seq_ports.c:537
snd_seq_port_disconnect+0x41c/0x5d0 sound/core/seq/seq_ports.c:616
snd_seq_ioctl_unsubscribe_port+0x1fc/0x400 sound/core/seq/seq_clientmgr.c:1537
snd_seq_kernel_client_ctl+0x102/0x1e0 sound/core/seq/seq_clientmgr.c:2369
snd_seq_oss_midi_close+0x44f/0x4d0 sound/core/seq/oss/seq_oss_midi.c:404
snd_seq_oss_synth_reset+0x422/0x880 sound/core/seq/oss/seq_oss_synth.c:406
snd_seq_oss_reset+0x6f/0x290 sound/core/seq/oss/seq_oss_init.c:435
snd_seq_oss_release+0x78/0x1a0 sound/core/seq/oss/seq_oss_init.c:412
odev_release+0x4f/0x70 sound/core/seq/oss/seq_oss.c:144
__fput+0x277/0x9d0 fs/file_table.c:317
task_work_run+0xdd/0x1a0 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:169 [inline]
exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
__do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181
do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203
entry_SYSENTER_compat_after_hwframe+0x70/0x82
The buggy address belongs to the object at ffff88807375a000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 93 bytes inside of
4096-byte region [ffff88807375a000, ffff88807375b000)
The buggy address belongs to the physical page:
page:ffffea0001cdd600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73758
head:ffffea0001cdd600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000010200 0000000000000000 dead000000000001 ffff888011843040
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 6245, tgid 6243 (syz-executor.2), ts 272327378171, free_ts 270846880918
prep_new_page mm/page_alloc.c:2456 [inline]
get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198
__alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426
alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272
alloc_slab_page mm/slub.c:1824 [inline]
allocate_slab+0x26c/0x3c0 mm/slub.c:1969
new_slab mm/slub.c:2029 [inline]
___slab_alloc+0x9c4/0xe20 mm/slub.c:3031
__slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118
slab_alloc_node mm/slub.c:3209 [inline]
__kmalloc_node+0x2cb/0x390 mm/slub.c:4490
kmalloc_node include/linux/slab.h:623 [inline]
kvmalloc_node+0x3e/0x190 mm/util.c:613
kvmalloc include/linux/slab.h:750 [inline]
kvmalloc_array include/linux/slab.h:768 [inline]
__ptr_ring_init_queue_alloc include/linux/ptr_ring.h:471 [inline]
ptr_ring_resize_multiple include/linux/ptr_ring.h:633 [inline]
skb_array_resize_multiple include/linux/skb_array.h:206 [inline]
pfifo_fast_change_tx_queue_len+0x154/0xb00 net/sched/sch_generic.c:903
qdisc_change_tx_queue_len net/sched/sch_generic.c:1374 [inline]
dev_qdisc_change_tx_queue_len+0x1c0/0x300 net/sched/sch_generic.c:1421
dev_change_tx_queue_len+0x149/0x180 net/core/dev.c:8722
do_setlink+0xb11/0x3bb0 net/core/rtnetlink.c:2803
rtnl_group_changelink net/core/rtnetlink.c:3302 [inline]
__rtnl_newlink+0xb96/0x17e0 net/core/rtnetlink.c:3556
rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593
rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089
netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1371 [inline]
free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421
free_unref_page_prepare mm/page_alloc.c:3343 [inline]
free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438
__unfreeze_partials+0x17c/0x1a0 mm/slub.c:2548
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:750 [inline]
slab_alloc_node mm/slub.c:3243 [inline]
kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3293
__alloc_skb+0x215/0x340 net/core/skbuff.c:414
alloc_skb include/linux/skbuff.h:1426 [inline]
alloc_skb_with_frags+0x93/0x730 net/core/skbuff.c:5992
sock_alloc_send_pskb+0x793/0x920 net/core/sock.c:2662
sock_alloc_send_skb include/net/sock.h:1831 [inline]
mld_newpack.isra.0+0x1b9/0x770 net/ipv6/mcast.c:1746
add_grhead+0x295/0x340 net/ipv6/mcast.c:1849
add_grec+0x1082/0x1560 net/ipv6/mcast.c:1987
mld_send_cr net/ipv6/mcast.c:2113 [inline]
mld_ifc_work+0x452/0xdc0 net/ipv6/mcast.c:2651
process_one_work+0x996/0x1610 kernel/workqueue.c:2289
worker_thread+0x665/0x1080 kernel/workqueue.c:2436
Memory state around the buggy address:
ffff888073759f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888073759f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807375a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807375a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807375a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
0: ff 48 89 decl -0x77(%rax)
3: df e8 fucomip %st(0),%st
5: f4 hlt
6: c2 4c f8 retq $0xf84c
9: e9 55 ff ff ff jmpq 0xffffff63
e: 4c 89 e7 mov %r12,%rdi
11: e8 e7 c2 4c f8 callq 0xf84cc2fd
16: eb 96 jmp 0xffffffae
18: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
1d: 66 90 xchg %ax,%ax
1f: 0f 00 2d 27 52 4c 00 verw 0x4c5227(%rip) # 0x4c524d
26: fb sti
27: f4 hlt
* 28: c3 retq <-- trapping instruction
29: cc int3
2a: cc int3
2b: cc int3
2c: cc int3
2d: 41 55 push %r13
2f: 41 54 push %r12
31: 55 push %rbp
32: 48 89 fd mov %rdi,%rbp
35: 53 push %rbx
36: e8 12 07 00 f8 callq 0xf800074d
3b: e8 .byte 0xe8
3c: 9d popfq
3d: 11 .byte 0x11