==================================================================
BUG: KASAN: use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1650
Read of size 1 at addr ffff88804d9a94e8 by task kworker/0:2/1040
CPU: 0 UID: 0 PID: 1040 Comm: kworker/0:2 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Workqueue: usb_hub_wq hub_event
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:2075 [inline]
__hrtimer_run_queues+0x448/0x9a0 kernel/time/hrtimer.c:2132
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2149
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:arch_atomic_set arch/x86/include/asm/atomic.h:28 [inline]
RIP: 0010:raw_atomic_set include/linux/atomic/atomic-arch-fallback.h:503 [inline]
RIP: 0010:atomic_set include/linux/atomic/atomic-instrumented.h:68 [inline]
RIP: 0010:__kernfs_new_node+0x3a4/0xa10 fs/kernfs/dir.c:686
Code: 01 00 00 00 48 8d 6b 04 be 04 00 00 00 48 89 ef e8 31 7b b9 ff 48 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 0f b6 14 02 <48> 89 e8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 02 05 00 00 48
RSP: 0018:ffffc90004c06868 EFLAGS: 00000a03
RAX: dffffc0000000000 RBX: ffff8880150ceb40 RCX: ffffffff82cc23ef
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff8880150ceb44
RBP: ffff8880150ceb44 R08: 0000000000000001 R09: ffffed1002a19d68
R10: ffff8880150ceb47 R11: 0000000000000000 R12: 1ffff92000980d14
R13: ffff88801eacf000 R14: ffff8880150cebc8 R15: ffff888015624000
kernfs_new_node fs/kernfs/dir.c:759 [inline]
kernfs_create_dir_ns+0xa4/0x2b0 fs/kernfs/dir.c:1133
sysfs_create_dir_ns+0x13a/0x2b0 fs/sysfs/dir.c:59
create_dir lib/kobject.c:73 [inline]
kobject_add_internal+0x2c8/0x930 lib/kobject.c:240
kobject_add_varg lib/kobject.c:374 [inline]
kobject_add+0x16a/0x1e0 lib/kobject.c:426
device_add+0x294/0x1970 drivers/base/core.c:3699
device_create_groups_vargs+0x1f8/0x270 drivers/base/core.c:4458
device_create+0xed/0x130 drivers/base/core.c:4497
usb_register_dev+0x2f0/0x570 drivers/usb/core/file.c:150
yurex_probe+0xb03/0xfb0 drivers/usb/misc/yurex.c:286
usb_probe_interface+0x386/0x980 drivers/usb/core/driver.c:399
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
driver_probe_device+0x4a/0x140 drivers/base/dd.c:899
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:503
__device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131
device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190
__bus_probe_device+0x60/0x160 drivers/base/bus.c:617
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_set_configuration+0xd97/0x1dc0 drivers/usb/core/message.c:2280
usb_generic_driver_probe+0xa1/0xe0 drivers/usb/core/generic.c:250
usb_probe_device+0xef/0x400 drivers/usb/core/driver.c:293
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
driver_probe_device+0x4a/0x140 drivers/base/dd.c:899
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:503
__device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131
device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190
__bus_probe_device+0x60/0x160 drivers/base/bus.c:617
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_new_device.part.0+0xcc2/0x1686 drivers/usb/core/hub.c:2713
usb_new_device include/linux/workqueue.h:715 [inline]
hub_port_connect drivers/usb/core/hub.c:5585 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5725 [inline]
port_event drivers/usb/core/hub.c:5889 [inline]
hub_event.cold+0x1e3/0xe90 drivers/usb/core/hub.c:5971
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495
process_scheduled_works kernel/workqueue.c:3578 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x594 pfn:0x4d9a9
flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000594 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x140cc2(GFP_HIGHUSER|__GFP_COMP), pid 6584, tgid 6577 (syz.3.111), ts 94807291059
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1854
prep_new_page mm/page_alloc.c:1862 [inline]
get_page_from_freelist+0x1113/0x35e0 mm/page_alloc.c:3933
__alloc_frozen_pages_noprof+0x2f6/0x3190 mm/page_alloc.c:5429
alloc_pages_mpol+0x201/0x560 mm/mempolicy.c:2511
alloc_pages_noprof mm/mempolicy.c:2602 [inline]
folio_alloc_noprof+0x22/0x250 mm/mempolicy.c:2612
filemap_alloc_folio_noprof.part.0+0x3db/0x440 mm/filemap.c:1018
filemap_alloc_folio_noprof mm/filemap.c:1004 [inline]
filemap_create_folio mm/filemap.c:2648 [inline]
filemap_get_pages+0x891/0x2080 mm/filemap.c:2738
filemap_read+0x3b0/0x10a0 mm/filemap.c:2842
generic_file_read_iter+0x344/0x450 mm/filemap.c:3034
__kernel_read+0x397/0xad0 fs/read_write.c:532
integrity_kernel_read+0x7e/0xb0 security/integrity/iint.c:28
ima_calc_file_hash_tfm+0x25e/0x350 security/integrity/ima/ima_crypto.c:222
ima_calc_file_hash+0x1e3/0x380 security/integrity/ima/ima_crypto.c:280
ima_collect_measurement+0x952/0xb30 security/integrity/ima/ima_api.c:300
process_measurement+0xdfe/0x2350 security/integrity/ima/ima_main.c:425
ima_file_check+0xc8/0x120 security/integrity/ima/ima_main.c:686
page last free pid 6577 tgid 6577 ts 97297930957 stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
__free_pages_prepare mm/page_alloc.c:1401 [inline]
free_unref_folios+0xa6a/0x17e0 mm/page_alloc.c:3012
folios_put_refs+0x585/0xaa0 mm/folio.c:1039
folio_batch_release include/linux/folio_batch.h:101 [inline]
truncate_inode_pages_range+0x30c/0x1040 mm/truncate.c:408
evict+0x8dc/0xad0 fs/inode.c:824
iput_final fs/inode.c:2014 [inline]
iput.part.0+0x989/0x1050 fs/inode.c:2063
iput+0x30/0x40 fs/inode.c:2029
dentry_unlink_inode+0x403/0x4d0 fs/dcache.c:493
dentry_kill+0x25d/0xca0 fs/dcache.c:840
shrink_kill fs/dcache.c:1289 [inline]
shrink_dentry_list+0x1e8/0x310 fs/dcache.c:1306
shrink_dcache_tree+0x209/0x410 fs/dcache.c:1775
do_one_tree+0x28/0x2d0 fs/dcache.c:1811
shrink_dcache_for_umount+0xf0/0x510 fs/dcache.c:1833
generic_shutdown_super+0x7e/0x360 fs/super.c:729
kill_anon_super+0x3a/0x60 fs/super.c:1355
deactivate_locked_super+0xbd/0x130 fs/super.c:586
deactivate_super fs/super.c:614 [inline]
deactivate_super+0xea/0x110 fs/super.c:610
Memory state around the buggy address:
ffff88804d9a9380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88804d9a9400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88804d9a9480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88804d9a9500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88804d9a9580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
----------------
Code disassembly (best guess):
0: 01 00 add %eax,(%rax)
2: 00 00 add %al,(%rax)
4: 48 8d 6b 04 lea 0x4(%rbx),%rbp
8: be 04 00 00 00 mov $0x4,%esi
d: 48 89 ef mov %rbp,%rdi
10: e8 31 7b b9 ff call 0xffb97b46
15: 48 89 ea mov %rbp,%rdx
18: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1f: fc ff df
22: 48 c1 ea 03 shr $0x3,%rdx
26: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx
* 2a: 48 89 e8 mov %rbp,%rax <-- trapping instruction
2d: 83 e0 07 and $0x7,%eax
30: 83 c0 03 add $0x3,%eax
33: 38 d0 cmp %dl,%al
35: 7c 08 jl 0x3f
37: 84 d2 test %dl,%dl
39: 0f 85 02 05 00 00 jne 0x541
3f: 48 rex.W