==================================================================
BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1618
Read of size 1 at addr ffff888023f9c127 by task syz.3.1708/14209
CPU: 0 UID: 0 PID: 14209 Comm: syz.3.1708 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
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:1618
handle_control_request drivers/usb/gadget/udc/dummy_hcd.c:1761 [inline]
dummy_timer+0x259e/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:1942
__run_hrtimer kernel/time/hrtimer.c:2067 [inline]
__hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0x194/0x210 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
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:raw_atomic_fetch_add_unless include/linux/atomic/atomic-arch-fallback.h:2429 [inline]
RIP: 0010:raw_atomic_add_unless include/linux/atomic/atomic-arch-fallback.h:2456 [inline]
RIP: 0010:atomic_add_unless include/linux/atomic/atomic-instrumented.h:1518 [inline]
RIP: 0010:page_ref_add_unless_zero include/linux/page_ref.h:251 [inline]
RIP: 0010:folio_ref_add_unless_zero include/linux/page_ref.h:260 [inline]
RIP: 0010:folio_try_get include/linux/page_ref.h:276 [inline]
RIP: 0010:find_get_entry mm/filemap.c:2099 [inline]
RIP: 0010:filemap_get_folios_tag+0x213/0xbb0 mm/filemap.c:2353
Code: 00 00 00 fc ff df 48 c1 e8 03 0f b6 14 08 4c 89 e0 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 c8 08 00 00 48 89 1c 24 8b 6b 34 48 51 c0 ff 31 ff 89 ee 41 89 ef e8 ac 4b c0 ff 85 ed 0f 84 8e
RSP: 0018:ffffc900054ff460 EFLAGS: 00000246
RAX: 0000000000000007 RBX: ffffea0001273000 RCX: dffffc0000000000
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffea0001273034
RBP: 0000000000000020 R08: 0000000000000001 R09: fffff9400024e606
R10: ffffea0001273037 R11: 0000000000000000 R12: ffffea0001273034
R13: ffffc900054ff8f8 R14: 0000000000000002 R15: ffffea00011f1800
writeback_get_folio mm/page-writeback.c:2417 [inline]
writeback_iter+0x9a7/0x1360 mm/page-writeback.c:2518
blkdev_writepages+0xe1/0x150 block/fops.c:486
do_writepages+0x278/0x600 mm/page-writeback.c:2560
filemap_writeback+0x22d/0x2e0 mm/filemap.c:387
filemap_fdatawrite_range mm/filemap.c:412 [inline]
filemap_write_and_wait_range mm/filemap.c:684 [inline]
filemap_write_and_wait_range+0xa6/0x130 mm/filemap.c:675
filemap_write_and_wait include/linux/pagemap.h:65 [inline]
sync_blockdev block/bdev.c:275 [inline]
sync_blockdev block/bdev.c:271 [inline]
bdev_release+0x4d3/0x6d0 block/bdev.c:1171
blkdev_release+0x15/0x20 block/fops.c:682
__fput+0x3ff/0xb50 fs/file_table.c:512
task_work_run+0x150/0x240 kernel/task_work.c:233
exit_task_work include/linux/task_work.h:40 [inline]
do_exit+0x951/0x2ae0 kernel/exit.c:1008
do_group_exit+0xd5/0x2a0 kernel/exit.c:1151
get_signal+0x1ec7/0x21e0 kernel/signal.c:3039
arch_do_signal_or_restart+0x91/0x7e0 arch/x86/kernel/signal.c:337
__exit_to_user_mode_loop kernel/entry/common.c:66 [inline]
exit_to_user_mode_loop+0x139/0x700 kernel/entry/common.c:101
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:336 [inline]
do_syscall_64+0x661/0x790 arch/x86/entry/syscall_64.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f556219e0d9
Code: Unable to access opcode bytes at 0x7f556219e0af.
RSP: 002b:00007f55630ee028 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: fffffffffffffffc RBX: 00007f5562425fa0 RCX: 00007f556219e0d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f5562235024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5562426038 R14: 00007f5562425fa0 R15: 00007ffe67706ef8
Allocated by task 12944:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5563
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
inetdev_init+0x66/0x570 net/ipv4/devinet.c:273
inetdev_event+0x827/0x17f0 net/ipv4/devinet.c:1590
notifier_call_chain+0x99/0x3f0 kernel/notifier.c:85
call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2275
call_netdevice_notifiers_extack net/core/dev.c:2313 [inline]
call_netdevice_notifiers net/core/dev.c:2327 [inline]
register_netdevice+0x1998/0x25a0 net/core/dev.c:11541
register_netdev+0x34/0x50 net/core/dev.c:11620
loopback_net_init+0x7a/0x170 drivers/net/loopback.c:218
ops_init+0x1e2/0x5f0 net/core/net_namespace.c:137
setup_net+0x118/0x3a0 net/core/net_namespace.c:450
copy_net_ns+0x46f/0x7c0 net/core/net_namespace.c:583
create_new_namespaces+0x3ea/0xac0 kernel/nsproxy.c:132
unshare_nsproxy_namespaces+0xf2/0x220 kernel/nsproxy.c:234
ksys_unshare+0x4a2/0xa70 kernel/fork.c:3292
__do_sys_unshare kernel/fork.c:3356 [inline]
__se_sys_unshare kernel/fork.c:3354 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:3354
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 12730:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2748 [inline]
slab_free mm/slub.c:6499 [inline]
kfree+0x22b/0x6d0 mm/slub.c:6792
rcu_do_batch kernel/rcu/tree.c:2650 [inline]
rcu_core+0x5f0/0x1260 kernel/rcu/tree.c:2919
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
do_softirq kernel/softirq.c:546 [inline]
do_softirq+0xaf/0xf0 kernel/softirq.c:533
__local_bh_enable_ip+0xff/0x120 kernel/softirq.c:473
lock_sock include/net/sock.h:1713 [inline]
netlink_insert+0xc9/0x17c0 net/netlink/af_netlink.c:558
netlink_autobind.isra.0+0x1f9/0x370 net/netlink/af_netlink.c:827
netlink_sendmsg+0x94e/0xda0 net/netlink/af_netlink.c:1863
sock_sendmsg_nosec net/socket.c:800 [inline]
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x48b/0x4e0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xe0/0x1c0 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Last potentially related work creation:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556
__call_rcu_common.constprop.0+0xa5/0x9b0 kernel/rcu/tree.c:3181
in_dev_finish_destroy+0x139/0x1b0 net/ipv4/devinet.c:262
in_dev_put include/linux/inetdevice.h:290 [inline]
inetdev_destroy net/ipv4/devinet.c:338 [inline]
inetdev_event+0xb26/0x17f0 net/ipv4/devinet.c:1655
notifier_call_chain+0x99/0x3f0 kernel/notifier.c:85
call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2275
call_netdevice_notifiers_extack net/core/dev.c:2313 [inline]
call_netdevice_notifiers net/core/dev.c:2327 [inline]
unregister_netdevice_many_notify+0x1149/0x2150 net/core/dev.c:12518
unregister_netdevice_many net/core/dev.c:12589 [inline]
default_device_exit_batch+0x907/0xbd0 net/core/dev.c:13288
ops_exit_list net/core/net_namespace.c:206 [inline]
ops_undo_list+0x363/0xab0 net/core/net_namespace.c:253
setup_net+0x1fa/0x3a0 net/core/net_namespace.c:466
copy_net_ns+0x46f/0x7c0 net/core/net_namespace.c:583
create_new_namespaces+0x3ea/0xac0 kernel/nsproxy.c:132
unshare_nsproxy_namespaces+0xf2/0x220 kernel/nsproxy.c:234
ksys_unshare+0x4a2/0xa70 kernel/fork.c:3292
__do_sys_unshare kernel/fork.c:3356 [inline]
__se_sys_unshare kernel/fork.c:3354 [inline]
__x64_sys_unshare+0x31/0x40 kernel/fork.c:3354
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff888023f9c000
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 295 bytes inside of
freed 512-byte region [ffff888023f9c000, ffff888023f9c200)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888023f9f800 pfn:0x23f9c
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000240 ffff88801c02bc80 ffffea000083ed10 ffffea000089a410
raw: ffff888023f9f800 0000000000100001 00000000f5000000 0000000000000000
head: 00fff00000000240 ffff88801c02bc80 ffffea000083ed10 ffffea000089a410
head: ffff888023f9f800 0000000000100001 00000000f5000000 0000000000000000
head: 00fff00000000002 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 9181, tgid 9176 (syz.1.892), ts 379388827055
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871
prep_new_page mm/page_alloc.c:1879 [inline]
get_page_from_freelist+0x110d/0x35b0 mm/page_alloc.c:3943
__alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436
alloc_slab_page mm/slub.c:3347 [inline]
allocate_slab mm/slub.c:3462 [inline]
new_slab+0xa9/0x6e0 mm/slub.c:3513
refill_objects+0xe3/0x410 mm/slub.c:7410
refill_sheaf mm/slub.c:2885 [inline]
__pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774
alloc_from_pcs mm/slub.c:4850 [inline]
slab_alloc_node mm/slub.c:4984 [inline]
__do_kmalloc_node mm/slub.c:5413 [inline]
__kmalloc_noprof+0x67c/0x840 mm/slub.c:5439
_kmalloc_noprof include/linux/slab.h:995 [inline]
usb_copy_descriptors+0xcd/0x320 drivers/usb/gadget/config.c:82
f_midi2_bind+0x1d37/0x2770 drivers/usb/gadget/function/f_midi2.c:2016
usb_add_function+0x219/0x890 drivers/usb/gadget/composite.c:333
configfs_composite_bind+0xd83/0x1960 drivers/usb/gadget/configfs.c:1802
gadget_bind_driver+0x28c/0xbf0 drivers/usb/gadget/udc/core.c:1662
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__driver_attach+0x21f/0x5b0 drivers/base/dd.c:1292
page last free pid 5582 tgid 5582 ts 349649905646 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1418 [inline]
__free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962
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:350
kasan_slab_alloc include/linux/kasan.h:253 [inline]
slab_post_alloc_hook mm/slub.c:4683 [inline]
slab_alloc_node mm/slub.c:4996 [inline]
__kmalloc_cache_noprof+0x278/0x6d0 mm/slub.c:5559
_kmalloc_noprof include/linux/slab.h:991 [inline]
poll_get_entry fs/select.c:168 [inline]
__pollwait+0x2c3/0x490 fs/select.c:223
poll_wait include/linux/poll.h:45 [inline]
pipe_poll+0x115/0x6c0 fs/pipe.c:759
vfs_poll include/linux/poll.h:82 [inline]
select_poll_one fs/select.c:480 [inline]
do_select+0xd54/0x1850 fs/select.c:536
core_sys_select+0x55b/0xbb0 fs/select.c:677
do_pselect.constprop.0+0x238/0x270 fs/select.c:770
__do_sys_pselect6 fs/select.c:809 [inline]
__se_sys_pselect6 fs/select.c:800 [inline]
__x64_sys_pselect6+0x149/0x1c0 fs/select.c:800
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888023f9c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888023f9c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888023f9c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888023f9c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888023f9c200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 00 00 add %al,(%rax)
2: 00 fc add %bh,%ah
4: ff lcall (bad)
5: df 48 c1 fisttps -0x3f(%rax)
8: e8 03 0f b6 14 call 0x14b60f10
d: 08 4c 89 e0 or %cl,-0x20(%rcx,%rcx,4)
11: 83 e0 07 and $0x7,%eax
14: 83 c0 03 add $0x3,%eax
17: 38 d0 cmp %dl,%al
19: 7c 08 jl 0x23
1b: 84 d2 test %dl,%dl
1d: 0f 85 c8 08 00 00 jne 0x8eb
23: 48 89 1c 24 mov %rbx,(%rsp)
27: 8b 6b 34 mov 0x34(%rbx),%ebp
* 2a: e8 48 51 c0 ff call 0xffc05177 <-- trapping instruction
2f: 31 ff xor %edi,%edi
31: 89 ee mov %ebp,%esi
33: 41 89 ef mov %ebp,%r15d
36: e8 ac 4b c0 ff call 0xffc04be7
3b: 85 ed test %ebp,%ebp
3d: 0f .byte 0xf
3e: 84 .byte 0x84
3f: 8e .byte 0x8e