xpad 6-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 6-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff88807b22285c by task syz-executor.1/5082 CPU: 0 PID: 5082 Comm: syz-executor.1 Not tainted 6.6.0-rc6-syzkaller-00285-g9c5d00cb7b6b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x50 kernel/locking/spinlock.c:162 __wake_up_common_lock+0xbb/0x140 kernel/sched/wait.c:137 __usb_unanchor_urb drivers/usb/core/urb.c:156 [inline] usb_anchor_resume_wakeups+0xc2/0xe0 drivers/usb/core/urb.c:150 __usb_hcd_giveback_urb+0x384/0x5c0 drivers/usb/core/hcd.c:1653 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1733 dummy_timer+0x1415/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x19e/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x764/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1074 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x70 kernel/locking/spinlock.c:194 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 86 33 26 f7 48 89 df e8 7e b2 26 f7 f7 c5 00 02 00 00 75 1f 9c 58 f6 c4 02 75 2f 01 00 00 00 e8 95 17 18 f7 65 8b 05 26 6a c1 75 85 c0 74 12 5b RSP: 0018:ffffc90003e6fc48 EFLAGS: 00000246 RAX: 0000000000000006 RBX: ffff8880b982b940 RCX: 1ffffffff1d988f9 RDX: 0000000000000000 RSI: ffffffff8a8cac20 RDI: ffffffff8ae92de0 RBP: 0000000000000246 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff8ecc7957 R11: 0000000000000000 R12: dffffc0000000000 R13: ffffc90003e6fdb0 R14: ffffffff8a4241fc R15: ffff88807dc61dd8 hrtimer_start_expires include/linux/hrtimer.h:432 [inline] hrtimer_sleeper_start_expires kernel/time/hrtimer.c:1968 [inline] do_nanosleep+0x1f5/0x500 kernel/time/hrtimer.c:2044 hrtimer_nanosleep+0x1ae/0x440 kernel/time/hrtimer.c:2100 common_nsleep+0xa1/0xc0 kernel/time/posix-timers.c:1350 __do_sys_clock_nanosleep_time32 kernel/time/posix-timers.c:1424 [inline] __se_sys_clock_nanosleep_time32 kernel/time/posix-timers.c:1401 [inline] __ia32_sys_clock_nanosleep_time32+0x334/0x4d0 kernel/time/posix-timers.c:1401 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7fa6579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f749fc80 EFLAGS: 00000293 ORIG_RAX: 000000000000010b RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000000000 RDX: 00000000f749fcb4 RSI: 00000000f749fcac RDI: 00000000f749fcb4 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 12774: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] xpad_probe+0x27e/0x1f40 drivers/input/joystick/xpad.c:2004 usb_probe_interface+0x307/0x930 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3624 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2207 usb_generic_driver_probe+0xca/0x130 drivers/usb/core/generic.c:238 usb_probe_device+0xda/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3624 usb_new_device+0xd80/0x1960 drivers/usb/core/hub.c:2597 hub_port_connect drivers/usb/core/hub.c:5459 [inline] hub_port_connect_change drivers/usb/core/hub.c:5599 [inline] port_event drivers/usb/core/hub.c:5759 [inline] hub_event+0x2dac/0x4e10 drivers/usb/core/hub.c:5841 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Freed by task 4785: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2185 usb_unbind_interface+0x1dd/0x8d0 drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:569 [inline] device_remove+0x11f/0x170 drivers/base/dd.c:561 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1295 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x39a/0xa50 drivers/base/core.c:3813 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1416 usb_disconnect+0x2e1/0x890 drivers/usb/core/hub.c:2260 hub_port_connect drivers/usb/core/hub.c:5299 [inline] hub_port_connect_change drivers/usb/core/hub.c:5599 [inline] port_event drivers/usb/core/hub.c:5759 [inline] hub_event+0x1db7/0x4e10 drivers/usb/core/hub.c:5841 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 batadv_hardif_release+0xa4/0xd0 net/batman-adv/hard-interface.c:56 kref_put include/linux/kref.h:65 [inline] batadv_hardif_put net/batman-adv/hard-interface.h:95 [inline] batadv_hardif_put net/batman-adv/hard-interface.h:90 [inline] batadv_hard_if_event+0x114d/0x1660 net/batman-adv/hard-interface.c:1020 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1995 call_netdevice_notifiers_extack net/core/dev.c:2033 [inline] call_netdevice_notifiers net/core/dev.c:2047 [inline] unregister_netdevice_many_notify+0x858/0x1980 net/core/dev.c:10967 ip_tunnel_delete_nets+0x2bb/0x3a0 net/ipv4/ip_tunnel.c:1144 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175 setup_net+0x64d/0xa40 net/core/net_namespace.c:362 copy_net_ns+0x2fa/0x670 net/core/net_namespace.c:491 create_new_namespaces+0x3ea/0xb10 kernel/nsproxy.c:110 copy_namespaces+0x464/0x560 kernel/nsproxy.c:179 copy_process+0x31c1/0x73f0 kernel/fork.c:2504 kernel_clone+0xfd/0x920 kernel/fork.c:2909 __do_compat_sys_ia32_clone+0xb7/0xf0 arch/x86/kernel/sys_ia32.c:254 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff88807b222800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff88807b222800, ffff88807b222c00) The buggy address belongs to the physical page: page:ffffea0001ec8800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807b227800 pfn:0x7b220 head:ffffea0001ec8800 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012c41dc0 ffffea000055a210 ffffea0000a84610 raw: ffff88807b227800 000000000010000e 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5082, tgid 5082 (syz-executor.1), ts 195411054606, free_ts 195171929864 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2297 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1025 [inline] __kmalloc_node_track_caller+0x50/0x100 mm/slab_common.c:1046 kmalloc_reserve+0xef/0x260 net/core/skbuff.c:581 __alloc_skb+0x12b/0x330 net/core/skbuff.c:650 alloc_skb include/linux/skbuff.h:1286 [inline] nlmsg_new include/net/netlink.h:999 [inline] inet6_rt_notify+0xf0/0x2b0 net/ipv6/route.c:6171 fib6_add_rt2node net/ipv6/ip6_fib.c:1257 [inline] fib6_add+0x24f7/0x4700 net/ipv6/ip6_fib.c:1483 __ip6_ins_rt net/ipv6/route.c:1303 [inline] ip6_ins_rt+0xb6/0x110 net/ipv6/route.c:1313 __ipv6_ifa_notify+0xc9b/0x11d0 net/ipv6/addrconf.c:6205 ipv6_ifa_notify net/ipv6/addrconf.c:6244 [inline] add_addr+0x237/0x350 net/ipv6/addrconf.c:3145 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x195/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1025 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1039 kmalloc include/linux/slab.h:603 [inline] tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x2a3/0x3b0 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:332 [inline] tomoyo_file_open+0xa8/0xd0 security/tomoyo/tomoyo.c:327 security_file_open+0x6a/0xe0 security/security.c:2836 do_dentry_open+0x538/0x1730 fs/open.c:916 do_open fs/namei.c:3640 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3797 do_filp_open+0x1de/0x430 fs/namei.c:3824 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 Memory state around the buggy address: ffff88807b222700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807b222780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807b222800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807b222880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807b222900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- 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 86 33 26 f7 call 0xf7263399 13: 48 89 df mov %rbx,%rdi 16: e8 7e b2 26 f7 call 0xf726b299 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 1f jne 0x42 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 2f jne 0x59 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 95 17 18 f7 call 0xf71817c9 34: 65 8b 05 26 6a c1 75 mov %gs:0x75c16a26(%rip),%eax # 0x75c16a61 3b: 85 c0 test %eax,%eax 3d: 74 12 je 0x51 3f: 5b pop %rbx