================================================================== 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 ffff88804eeaa112 by task kworker/2:4/5831 CPU: 2 UID: 0 PID: 5831 Comm: kworker/2:4 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 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: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:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:221 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 36 93 11 f6 48 89 df e8 be e9 11 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 05 cd 00 f6 65 48 83 3d b4 03 b8 09 00 74 16 5b RSP: 0000:ffffc9000623eaf8 EFLAGS: 00000246 RAX: 0000000000000002 RBX: ffff88802b226380 RCX: 0000000000000040 RDX: 0000000000000001 RSI: ffffffff8e3e0f3d RDI: ffffffff8c625a80 RBP: 0000000000000283 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88802b226380 R13: 0000000000000000 R14: 00000000ffffffff R15: ffff88802b2263c8 __mod_timer+0x409/0xca0 kernel/time/timer.c:1139 cxacru_start_wait_urb+0xda/0x200 drivers/usb/atm/cxacru.c:598 cxacru_cm+0x410/0x9a0 drivers/usb/atm/cxacru.c:657 cxacru_card_status+0x21/0xf0 drivers/usb/atm/cxacru.c:762 cxacru_bind+0xa3a/0x1440 drivers/usb/atm/cxacru.c:1218 usbatm_usb_probe+0x378/0x1b50 drivers/usb/atm/usbatm.c:1058 cxacru_usb_probe+0x101/0x200 drivers/usb/atm/cxacru.c:1364 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 Allocated by task 39: 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] __do_kmalloc_node mm/slub.c:5414 [inline] __kmalloc_noprof+0x32f/0x840 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] fib6_info_alloc+0x40/0x160 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x14c/0xad0 net/ipv6/route.c:3839 ip6_route_add+0x4b/0x1d0 net/ipv6/route.c:3968 addrconf_prefix_route+0x2fb/0x510 net/ipv6/addrconf.c:2504 addrconf_add_linklocal+0x329/0x500 net/ipv6/addrconf.c:3337 addrconf_addr_gen+0x364/0x3b0 net/ipv6/addrconf.c:3471 addrconf_dev_config net/ipv6/addrconf.c:3518 [inline] addrconf_init_auto_addrs+0x1cb/0x780 net/ipv6/addrconf.c:3596 addrconf_notify+0xa10/0x1ba0 net/ipv6/addrconf.c:3776 notifier_call_chain+0x99/0x3f0 kernel/notifier.c:85 call_netdevice_notifiers_info+0xbe/0x110 net/core/dev.c:2275 netif_state_change+0x165/0x380 net/core/dev.c:1625 linkwatch_do_dev net/core/link_watch.c:186 [inline] linkwatch_do_dev+0xe0/0x120 net/core/link_watch.c:166 __linkwatch_run_queue+0x3a9/0x900 net/core/link_watch.c:240 linkwatch_event+0x8f/0xc0 net/core/link_watch.c:314 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 13752: 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 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: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 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 call_rcu_hurry include/linux/rcupdate.h:134 [inline] fib6_info_release include/net/ip6_fib.h:344 [inline] fib6_info_release include/net/ip6_fib.h:340 [inline] fib6_del_route net/ipv6/ip6_fib.c:2062 [inline] fib6_del+0xf60/0x1790 net/ipv6/ip6_fib.c:2096 fib6_clean_node+0x426/0x5d0 net/ipv6/ip6_fib.c:2258 fib6_walk_continue+0x451/0x8d0 net/ipv6/ip6_fib.c:2180 fib6_walk+0x182/0x350 net/ipv6/ip6_fib.c:2228 fib6_clean_tree+0xdc/0x120 net/ipv6/ip6_fib.c:2308 __fib6_clean_all+0x107/0x2d0 net/ipv6/ip6_fib.c:2324 rt6_sync_down_dev net/ipv6/route.c:5049 [inline] rt6_disable_ip+0x2a6/0x980 net/ipv6/route.c:5054 addrconf_ifdown.isra.0+0x11d/0x1b70 net/ipv6/addrconf.c:3889 addrconf_notify+0x4a3/0x1ba0 net/ipv6/addrconf.c:3812 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] netif_close_many+0x3e7/0x810 net/core/dev.c:1829 unregister_netdevice_many_notify+0x840/0x2150 net/core/dev.c:12533 unregister_netdevice_many net/core/dev.c:12635 [inline] default_device_exit_batch+0x6c6/0x890 net/core/dev.c:13347 ops_exit_list net/core/net_namespace.c:206 [inline] ops_undo_list+0x363/0xab0 net/core/net_namespace.c:253 cleanup_net+0x499/0x920 net/core/net_namespace.c:706 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 ffff88804eeaa000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 274 bytes inside of freed 512-byte region [ffff88804eeaa000, ffff88804eeaa200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88804eea8c00 pfn:0x4eea8 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 ffffea0001847e10 ffffea0001836810 raw: ffff88804eea8c00 0000000000100009 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d042c80 ffffea0001847e10 ffffea0001836810 head: ffff88804eea8c00 0000000000100009 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 9969, tgid 9968 (syz.0.1227), ts 234239359093 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+0x54c/0x6e0 sound/core/oss/mixer_oss.c:983 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 70 tgid 70 ts 233507782423 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 pcpu_free_pages.isra.0+0x13c/0x1c0 mm/percpu-vm.c:73 pcpu_reclaim_populated mm/percpu.c:2166 [inline] pcpu_balance_workfn+0x25e/0xe00 mm/percpu.c:2222 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 Memory state around the buggy address: ffff88804eeaa000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804eeaa080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804eeaa100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804eeaa180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804eeaa200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 36 93 11 f6 call 0xf6119349 13: 48 89 df mov %rbx,%rdi 16: e8 be e9 11 f6 call 0xf611e9d9 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 05 cd 00 f6 call 0xf600cd39 34: 65 48 83 3d b4 03 b8 cmpq $0x0,%gs:0x9b803b4(%rip) # 0x9b803f1 3b: 09 00 3d: 74 16 je 0x55 3f: 5b pop %rbx