================================================================== BUG: KASAN: slab-use-after-free in find_endpoint+0x2a3/0x2c0 drivers/usb/gadget/udc/dummy_hcd.c:1622 Read of size 1 at addr ffff8880794e4512 by task syz.0.5543/32718 CPU: 0 UID: 0 PID: 32718 Comm: syz.0.5543 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:1622 dummy_timer+0x500/0x3820 drivers/usb/gadget/udc/dummy_hcd.c:1894 __run_hrtimer kernel/time/hrtimer.c:2074 [inline] __hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2131 hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2148 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+0x16a/0x210 kernel/softirq.c:758 irq_exit_rcu+0x9/0x30 kernel/softirq.c:775 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:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:206 Code: 96 33 61 00 48 89 df 5b e9 0d 17 67 00 be 03 00 00 00 5b e9 22 20 1f 03 66 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1e fa 65 48 8b 05 ac bd 81 13 48 8b 34 24 65 48 8b 15 90 bd RSP: 0018:ffffc90005ccf2b8 EFLAGS: 00000287 RAX: 0000000000001621 RBX: 0000000000000200 RCX: ffffc9002763c000 RDX: 0000000000080000 RSI: ffffffff81d0d64f RDI: ffff888026308000 RBP: 0000000000000040 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000200 R11: 0000000000000000 R12: 0000000000000001 R13: 001fffffffc00000 R14: 001fffffffc00040 R15: 1ffff92000b99e5a __cancel_work+0x245/0x340 kernel/workqueue.c:4549 __cancel_work_sync kernel/workqueue.c:4556 [inline] cancel_work_sync+0x1d/0xf0 kernel/workqueue.c:4605 snd_rawmidi_input_trigger sound/core/rawmidi.c:222 [inline] snd_rawmidi_input_trigger sound/core/rawmidi.c:216 [inline] snd_rawmidi_drain_input+0xdb/0x280 sound/core/rawmidi.c:297 snd_rawmidi_input_params+0x53/0x1d0 sound/core/rawmidi.c:773 midisynth_subscribe+0x199/0x410 sound/core/seq/seq_midi.c:218 subscribe_port sound/core/seq/seq_ports.c:434 [inline] check_and_subscribe_port+0x86b/0xc50 sound/core/seq/seq_ports.c:516 snd_seq_port_connect+0x306/0x540 sound/core/seq/seq_ports.c:589 snd_seq_ioctl_subscribe_port+0x219/0x490 sound/core/seq/seq_clientmgr.c:1521 call_seq_client_ctl+0xa3/0x130 sound/core/seq/seq_clientmgr.c:2467 snd_seq_kernel_client_ctl+0x35/0x50 sound/core/seq/seq_clientmgr.c:2495 snd_seq_oss_midi_open+0x465/0x680 sound/core/seq/oss/seq_oss_midi.c:350 snd_seq_oss_synth_setup_midi+0x131/0x590 sound/core/seq/oss/seq_oss_synth.c:247 snd_seq_oss_open+0x82e/0xa10 sound/core/seq/oss/seq_oss_init.c:255 odev_open+0x6f/0x90 sound/core/seq/oss/seq_oss.c:128 soundcore_open+0x2e3/0x5a0 sound/sound_core.c:594 chrdev_open+0x234/0x6a0 fs/char_dev.c:411 do_dentry_open+0x6ab/0x14d0 fs/open.c:996 vfs_open+0x82/0x3f0 fs/open.c:1101 do_open fs/namei.c:4866 [inline] path_openat+0x19fa/0x2440 fs/namei.c:5029 do_file_open+0x20e/0x430 fs/namei.c:5058 do_sys_openat2+0x10f/0x1e0 fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_compat_sys_openat fs/open.c:1485 [inline] __se_compat_sys_openat fs/open.c:1483 [inline] __ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1483 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7f68fec Code: Unable to access opcode bytes at 0xf7f68fc2. RSP: 002b:00000000f541650c EFLAGS: 00000292 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 00000000800001c0 RDX: 0000000000028000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5820: 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:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 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] snd_mixer_oss_build_test+0x7a/0x380 sound/core/oss/mixer_oss.c:893 snd_mixer_oss_build_test_all+0x33c/0x6e0 sound/core/oss/mixer_oss.c:963 snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017 snd_mixer_oss_build sound/core/oss/mixer_oss.c:1276 [inline] snd_mixer_oss_notify_handler+0x48d/0x990 sound/core/oss/mixer_oss.c:1344 snd_card_register+0x2af/0x760 sound/core/init.c:936 try_to_register_card+0x1d6/0x390 sound/usb/card.c:903 usb_audio_probe+0x9f4/0x3b10 sound/usb/card.c:1080 usb_probe_interface+0x386/0x9b0 drivers/usb/core/driver.c:399 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 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098 device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153 bus_probe_device+0x64/0x160 drivers/base/bus.c:620 device_add+0x121d/0x1970 drivers/base/core.c:3776 usb_set_configuration+0xd97/0x1dc0 drivers/usb/core/message.c:2274 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: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 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098 device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153 bus_probe_device+0x64/0x160 drivers/base/bus.c:620 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:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 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 Freed by task 5820: 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:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6509 [inline] kfree+0x22b/0x6d0 mm/slub.c:6802 __free_kfree include/linux/slab.h:599 [inline] snd_mixer_oss_build_test+0x118/0x380 sound/core/oss/mixer_oss.c:892 snd_mixer_oss_build_test_all+0x33c/0x6e0 sound/core/oss/mixer_oss.c:963 snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017 snd_mixer_oss_build sound/core/oss/mixer_oss.c:1276 [inline] snd_mixer_oss_notify_handler+0x48d/0x990 sound/core/oss/mixer_oss.c:1344 snd_card_register+0x2af/0x760 sound/core/init.c:936 try_to_register_card+0x1d6/0x390 sound/usb/card.c:903 usb_audio_probe+0x9f4/0x3b10 sound/usb/card.c:1080 usb_probe_interface+0x386/0x9b0 drivers/usb/core/driver.c:399 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 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098 device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153 bus_probe_device+0x64/0x160 drivers/base/bus.c:620 device_add+0x121d/0x1970 drivers/base/core.c:3776 usb_set_configuration+0xd97/0x1dc0 drivers/usb/core/message.c:2274 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: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 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098 device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153 bus_probe_device+0x64/0x160 drivers/base/bus.c:620 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:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 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 object at ffff8880794e4400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 274 bytes inside of freed 512-byte region [ffff8880794e4400, ffff8880794e4600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880794e4000 pfn:0x794e4 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 ffff88801d042c80 ffffea0001883810 ffffea00013add10 raw: ffff8880794e4000 0000000000100006 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d042c80 ffffea0001883810 ffffea00013add10 head: ffff8880794e4000 0000000000100006 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 15073, tgid 15072 (syz.0.1496), ts 464066505535 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/0x35d0 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:7418 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] __kmalloc_cache_noprof+0x4f4/0x6d0 mm/slub.c:5559 _kmalloc_noprof include/linux/slab.h:991 [inline] snd_mixer_oss_build_test+0x7a/0x380 sound/core/oss/mixer_oss.c:893 snd_mixer_oss_build_test_all+0x1ac/0x6e0 sound/core/oss/mixer_oss.c:948 snd_mixer_oss_build_input+0x139/0xd50 sound/core/oss/mixer_oss.c:1017 snd_mixer_oss_build sound/core/oss/mixer_oss.c:1276 [inline] snd_mixer_oss_notify_handler+0x48d/0x990 sound/core/oss/mixer_oss.c:1344 snd_card_register+0x2af/0x760 sound/core/init.c:936 f_midi2_create_card drivers/usb/gadget/function/f_midi2.c:1615 [inline] f_midi2_bind+0x1198/0x2770 drivers/usb/gadget/function/f_midi2.c:1947 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 page last free pid 65 tgid 65 ts 458955829558 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:361 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] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_node_track_caller_noprof+0x2da/0x870 mm/slub.c:5545 kvasprintf+0xbc/0x150 lib/kasprintf.c:25 kasprintf+0xc7/0x100 lib/kasprintf.c:59 device_get_devnode+0xb5/0x2c0 drivers/base/core.c:4060 devtmpfs_delete_node+0xc8/0x1d0 drivers/base/devtmpfs.c:163 device_del+0x717/0x9b0 drivers/base/core.c:3944 usb_disconnect+0x5b5/0x9a0 drivers/usb/core/hub.c:2386 hub_port_connect drivers/usb/core/hub.c:5425 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event+0x1bb1/0x4420 drivers/usb/core/hub.c:5971 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 Memory state around the buggy address: ffff8880794e4400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880794e4480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880794e4500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880794e4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880794e4600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 96 xchg %eax,%esi 1: 33 61 00 xor 0x0(%rcx),%esp 4: 48 89 df mov %rbx,%rdi 7: 5b pop %rbx 8: e9 0d 17 67 00 jmp 0x67171a d: be 03 00 00 00 mov $0x3,%esi 12: 5b pop %rbx 13: e9 22 20 1f 03 jmp 0x31f203a 18: 66 90 xchg %ax,%ax 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 90 nop 1f: 90 nop 20: 90 nop 21: 90 nop 22: 90 nop 23: 90 nop 24: 90 nop 25: 90 nop 26: 90 nop 27: 90 nop 28: 90 nop 29: 90 nop * 2a: f3 0f 1e fa endbr64 <-- trapping instruction 2e: 65 48 8b 05 ac bd 81 mov %gs:0x1381bdac(%rip),%rax # 0x1381bde2 35: 13 36: 48 8b 34 24 mov (%rsp),%rsi 3a: 65 gs 3b: 48 rex.W 3c: 8b .byte 0x8b 3d: 15 .byte 0x15 3e: 90 nop 3f: bd .byte 0xbd