==================================================================
BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650
Read of size 1 at addr ffff888061cb7ce8 by task syz.2.1047/10445
CPU: 2 UID: 0 PID: 10445 Comm: syz.2.1047 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1c0 mm/kasan/report.c:595
find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650
dummy_timer+0x506/0x3840 drivers/usb/gadget/udc/dummy_hcd.c:1922
__run_hrtimer kernel/time/hrtimer.c:2079 [inline]
__hrtimer_run_queues+0x448/0x9a0 kernel/time/hrtimer.c:2136
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2153
handle_softirqs+0x216/0xa20 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x178/0x220 kernel/softirq.c:786
irq_exit_rcu+0x9/0x30 kernel/softirq.c:809
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:preempt_schedule_irq+0x49/0x90 kernel/sched/core.c:7666
Code: 00 00 00 fc ff df 48 89 eb 48 c1 eb 03 48 01 d3 f6 c4 02 75 47 bf 01 00 00 00 e8 f2 e3 e7 f5 e8 9d be 25 f6 fb bf 01 00 00 00 62 7b ff ff 9c 58 fa f6 c4 02 75 1e bf 01 00 00 00 e8 20 84 e7
RSP: 0018:ffffc90000597978 EFLAGS: 00000206
RAX: 00000000000007ed RBX: ffffed1002b24000 RCX: 0000000000000040
RDX: 0000000000000001 RSI: ffffffff8e627f98 RDI: 0000000000000001
RBP: ffff888015920000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
irqentry_exit_cond_resched arch/x86/include/asm/fred.h:105 [inline]
irqentry_exit_to_kernel_mode_preempt include/linux/irq-entry-common.h:453 [inline]
irqentry_exit_to_kernel_mode include/linux/irq-entry-common.h:543 [inline]
irqentry_exit+0x33f/0xab0 kernel/entry/common.c:154
asm_sysvec_reschedule_ipi+0x1a/0x20 arch/x86/include/asm/idtentry.h:679
RIP: 0010:static_key_count+0x42/0x70 kernel/jump_label.c:112
Code: 36 00 48 89 da 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 0f b6 14 02 48 89 d8 83 e0 07 83 c0 03 38 d0 7c 04 84 d2 75 22 8b 1b <31> ff 89 de e8 95 04 bd ff b8 01 00 00 00 85 db 0f 48 d8 e8 16 0a
RSP: 0018:ffffc90000597a80 EFLAGS: 00000246
RAX: 0000000000000003 RBX: 0000000000000001 RCX: ffffffff8250e6ca
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff9ce11280
RBP: 0000000000000000 R08: 0000000000000000 R09: fffffbfff39c2250
R10: ffffffff9ce11283 R11: 0000000000000000 R12: dffffc0000000000
R13: ffff888014f41880 R14: 0000000000000020 R15: dffffc0000000000
security_vm_enough_memory_mm+0x47/0x110 security/security.c:761
mprotect_fixup+0xc7b/0x1340 mm/mprotect.c:814
do_mprotect_pkey+0xa69/0xdf0 mm/mprotect.c:1001
__do_sys_mprotect mm/mprotect.c:1022 [inline]
__se_sys_mprotect mm/mprotect.c:1019 [inline]
__ia32_sys_mprotect+0x75/0xb0 mm/mprotect.c:1019
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline]
__do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286
do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf7f42fbc
Code: d2 74 05 c1 e8 0c 89 02 8b 5d fc 31 c0 c9 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 2e 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 58 b8
RSP: 002b:00000000ff8875d8 EFLAGS: 00000286 ORIG_RAX: 000000000000007d
RAX: ffffffffffffffda RBX: 00000000f53b6000 RCX: 0000000000020000
RDX: 0000000000000003 RSI: 0000000000001000 RDI: 0000000000021000
RBP: 00000000f53d5b40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 10123:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x40 mm/kasan/common.c:79
poison_kmalloc_redzone mm/kasan/common.c:412 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:429
kasan_kmalloc include/linux/kasan.h:267 [inline]
__kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5680
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
queue_new sound/core/seq/seq_queue.c:92 [inline]
snd_seq_queue_alloc+0x56/0x540 sound/core/seq/seq_queue.c:164
snd_seq_ioctl_create_queue+0xa9/0x370 sound/core/seq/seq_clientmgr.c:1567
call_seq_client_ctl+0xa3/0x130 sound/core/seq/seq_clientmgr.c:2462
snd_seq_kernel_client_ctl+0x7c/0xd0 sound/core/seq/seq_clientmgr.c:2490
alloc_seq_queue+0xdb/0x180 sound/core/seq/oss/seq_oss_init.c:352
snd_seq_oss_open+0x2b2/0xa40 sound/core/seq/oss/seq_oss_init.c:209
odev_open+0x6f/0x90 sound/core/seq/oss/seq_oss.c:131
soundcore_open+0x2e3/0x5a0 sound/sound_core.c:594
chrdev_open+0x234/0x6a0 fs/char_dev.c:413
do_dentry_open+0x674/0x1470 fs/open.c:1000
vfs_open_consume+0xcc/0x460 fs/open.c:1131
do_open fs/namei.c:4851 [inline]
path_openat+0x1547/0x23f0 fs/namei.c:5016
do_file_open+0x20e/0x430 fs/namei.c:5045
do_sys_openat2+0x163/0x1d0 fs/open.c:1443
do_sys_open fs/open.c:1449 [inline]
__do_compat_sys_openat fs/open.c:1511 [inline]
__se_compat_sys_openat fs/open.c:1509 [inline]
__ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1509
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline]
__do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286
do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
Freed by task 10122:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x40 mm/kasan/common.c:79
kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:599
poison_slab_object mm/kasan/common.c:267 [inline]
__kasan_slab_free+0x73/0x90 mm/kasan/common.c:299
kasan_slab_free include/linux/kasan.h:239 [inline]
slab_free_hook mm/slub.c:2780 [inline]
slab_free mm/slub.c:6637 [inline]
kfree+0x22d/0x6d0 mm/slub.c:6930
snd_seq_queue_delete+0x45/0x60 sound/core/seq/seq_queue.c:188
call_seq_client_ctl+0xa3/0x130 sound/core/seq/seq_clientmgr.c:2462
snd_seq_kernel_client_ctl+0x7c/0xd0 sound/core/seq/seq_clientmgr.c:2490
delete_seq_queue.isra.0+0xcb/0x140 sound/core/seq/oss/seq_oss_init.c:372
odev_release+0x4c/0x70 sound/core/seq/oss/seq_oss.c:144
__fput+0x3fb/0xb50 fs/file_table.c:512
fput_close_sync+0x118/0x250 fs/file_table.c:618
filp_close_sync+0x75/0xa0 fs/open.c:1574
__range_close+0x4a6/0x8b0 fs/file.c:919
__do_sys_close_range fs/file.c:1003 [inline]
__se_sys_close_range fs/file.c:954 [inline]
__ia32_sys_close_range+0x1f8/0x430 fs/file.c:954
do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline]
__do_fast_syscall_32+0x14d/0x8e0 arch/x86/entry/syscall_32.c:286
do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:311
entry_SYSENTER_compat_after_hwframe+0x84/0x8e
The buggy address belongs to the object at ffff888061cb7c00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 232 bytes inside of
freed 512-byte region [ffff888061cb7c00, ffff888061cb7e00)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888061cb6400 pfn:0x61cb4
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 04fff00000000240 ffff88801d442c80 ffffea0001340810 ffffea000187b710
raw: ffff888061cb6400 000000000010000c 00000000f5000000 0000000000000000
head: 04fff00000000240 ffff88801d442c80 ffffea0001340810 ffffea000187b710
head: ffff888061cb6400 000000000010000c 00000000f5000000 0000000000000000
head: 04fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
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 5788, tgid 5788 (syz-executor), ts 38914971977
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1873
prep_new_page mm/page_alloc.c:1881 [inline]
get_page_from_freelist+0xdae/0x2c80 mm/page_alloc.c:3963
__alloc_frozen_pages_noprof+0x2ad/0x31e0 mm/page_alloc.c:5505
alloc_slab_page mm/slub.c:3384 [inline]
allocate_slab mm/slub.c:3499 [inline]
new_slab+0xb1/0x6d0 mm/slub.c:3550
refill_objects+0xe3/0x410 mm/slub.c:7546
refill_sheaf mm/slub.c:2917 [inline]
__pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811
alloc_from_pcs mm/slub.c:4887 [inline]
slab_alloc_node mm/slub.c:5021 [inline]
__do_kmalloc_node mm/slub.c:5530 [inline]
__kmalloc_noprof+0x677/0x840 mm/slub.c:5556
_kmalloc_noprof include/linux/slab.h:995 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
udp_tunnel_nic_alloc net/ipv4/udp_tunnel_nic.c:758 [inline]
udp_tunnel_nic_register net/ipv4/udp_tunnel_nic.c:835 [inline]
udp_tunnel_nic_netdevice_event+0x128a/0x1db0 net/ipv4/udp_tunnel_nic.c:933
notifier_call_chain+0x99/0x3f0 kernel/notifier.c:86
call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2313
call_netdevice_notifiers_extack net/core/dev.c:2351 [inline]
call_netdevice_notifiers net/core/dev.c:2365 [inline]
register_netdevice+0x16f5/0x26b0 net/core/dev.c:11778
nsim_init_netdevsim drivers/net/netdevsim/netdev.c:1080 [inline]
nsim_create+0xba6/0x12f0 drivers/net/netdevsim/netdev.c:1162
__nsim_dev_port_add+0x3ba/0x8f0 drivers/net/netdevsim/dev.c:1433
nsim_dev_port_add_all drivers/net/netdevsim/dev.c:1494 [inline]
nsim_drv_probe+0xd72/0x1350 drivers/net/netdevsim/dev.c:1655
call_driver_probe drivers/base/dd.c:629 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:707
__driver_probe_device+0x210/0x460 drivers/base/dd.c:869
page last free pid 5780 tgid 5780 ts 37754566441 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1415 [inline]
__free_frozen_pages+0x7b1/0x10f0 mm/page_alloc.c:2971
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:364
kasan_slab_alloc include/linux/kasan.h:257 [inline]
slab_post_alloc_hook mm/slub.c:4720 [inline]
slab_alloc_node mm/slub.c:5033 [inline]
kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5047
__kernfs_new_node+0xd2/0xa10 fs/kernfs/dir.c:667
kernfs_new_node+0x194/0x200 fs/kernfs/dir.c:759
__kernfs_create_file+0x53/0x350 fs/kernfs/file.c:1071
sysfs_add_file_mode_ns+0x207/0x3c0 fs/sysfs/file.c:316
create_files fs/sysfs/group.c:82 [inline]
internal_create_group+0x593/0xfb0 fs/sysfs/group.c:189
internal_create_groups+0x9d/0x150 fs/sysfs/group.c:229
setup_port+0x409/0x16c0 drivers/infiniband/core/sysfs.c:1207
ib_setup_port_attrs+0x201/0x600 drivers/infiniband/core/sysfs.c:1393
ib_register_device drivers/infiniband/core/device.c:1496 [inline]
ib_register_device+0x8a7/0xdd0 drivers/infiniband/core/device.c:1441
rxe_register_device+0x277/0x360 drivers/infiniband/sw/rxe/rxe_verbs.c:1555
rxe_net_add+0x95/0xf0 drivers/infiniband/sw/rxe/rxe_net.c:659
Memory state around the buggy address:
ffff888061cb7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888061cb7c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888061cb7c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888061cb7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888061cb7d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 fc add %bh,%ah
4: ff lcall (bad)
5: df 48 89 fisttps -0x77(%rax)
8: eb 48 jmp 0x52
a: c1 eb 03 shr $0x3,%ebx
d: 48 01 d3 add %rdx,%rbx
10: f6 c4 02 test $0x2,%ah
13: 75 47 jne 0x5c
15: bf 01 00 00 00 mov $0x1,%edi
1a: e8 f2 e3 e7 f5 call 0xf5e7e411
1f: e8 9d be 25 f6 call 0xf625bec1
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 62 7b ff ff call 0xffff7b91 <-- trapping instruction
2f: 9c pushf
30: 58 pop %rax
31: fa cli
32: f6 c4 02 test $0x2,%ah
35: 75 1e jne 0x55
37: bf 01 00 00 00 mov $0x1,%edi
3c: e8 .byte 0xe8
3d: 20 .byte 0x20
3e: 84 e7 test %ah,%bh