xpad 4-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 4-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:86 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115 Read of size 4 at addr ffff88802326185c by task syz-executor.4/24926 CPU: 1 PID: 24926 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00007-g4d2008430ce8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x60 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:105 [inline] __wake_up+0x1c/0x60 kernel/sched/wait.c:127 __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+0x392/0x5c0 drivers/usb/core/hcd.c:1651 usb_hcd_giveback_urb+0x396/0x450 drivers/usb/core/hcd.c:1732 dummy_timer+0x17fc/0x3940 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a0/0x610 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers+0x74b/0xaf0 kernel/time/timer.c:2418 __run_timer_base kernel/time/timer.c:2429 [inline] __run_timer_base kernel/time/timer.c:2422 [inline] run_timer_base+0x111/0x190 kernel/time/timer.c:2438 run_timer_softirq+0x1a/0x40 kernel/time/timer.c:2448 __do_softirq+0x218/0x922 kernel/softirq.c:554 invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:633 [inline] irq_exit_rcu+0xb9/0x120 kernel/softirq.c:645 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 56 1f 8d f6 48 89 df e8 ae 9b 8d f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 75 d9 7e f6 65 8b 05 56 1c 25 75 85 c0 74 16 5b RSP: 0018:ffffc9000330f6d0 EFLAGS: 00000246 RAX: 0000000000000006 RBX: ffff8880292bd340 RCX: 1ffffffff27d09de RDX: 0000000000000000 RSI: ffffffff8b0cae00 RDI: ffffffff8b6f5720 RBP: 0000000000000246 R08: 0000000000000001 R09: fffffbfff27bb067 R10: ffffffff93dd833f R11: 0000000000000005 R12: 1ffff92000661edf R13: ffff888021bd1e00 R14: 0000000000000001 R15: 0000000000000001 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] unlock_task_sighand include/linux/sched/signal.h:754 [inline] do_send_sig_info kernel/signal.c:1302 [inline] group_send_sig_info+0x2db/0x300 kernel/signal.c:1453 bpf_send_signal_common+0x2e8/0x3a0 kernel/trace/bpf_trace.c:881 ____bpf_send_signal_thread kernel/trace/bpf_trace.c:898 [inline] bpf_send_signal_thread+0x16/0x20 kernel/trace/bpf_trace.c:896 ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:1997 __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2236 bpf_dispatcher_nop_func include/linux/bpf.h:1234 [inline] __bpf_prog_run include/linux/filter.h:657 [inline] bpf_prog_run include/linux/filter.h:664 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2381 [inline] bpf_trace_run4+0x176/0x460 kernel/trace/bpf_trace.c:2422 __bpf_trace_mmap_lock_acquire_returned+0x134/0x180 include/trace/events/mmap_lock.h:52 __traceiter_mmap_lock_acquire_returned+0x82/0xe0 include/trace/events/mmap_lock.h:52 trace_mmap_lock_acquire_returned include/trace/events/mmap_lock.h:52 [inline] __mmap_lock_do_trace_acquire_returned+0x456/0x790 mm/mmap_lock.c:237 __mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline] mmap_read_lock_killable include/linux/mmap_lock.h:156 [inline] __get_user_pages_locked mm/gup.c:1580 [inline] faultin_page_range+0x42c/0x9f0 mm/gup.c:1749 madvise_populate mm/madvise.c:918 [inline] madvise_vma_behavior+0x8e0/0x1b20 mm/madvise.c:1026 madvise_walk_vmas+0x1cf/0x2c0 mm/madvise.c:1248 do_madvise+0x309/0x640 mm/madvise.c:1428 __do_sys_madvise mm/madvise.c:1441 [inline] __se_sys_madvise mm/madvise.c:1439 [inline] __x64_sys_madvise+0xa9/0x110 mm/madvise.c:1439 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f62cf87dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f62d06010c8 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f62cf9abf80 RCX: 00007f62cf87dea9 RDX: 0000000000000017 RSI: 0000000000800000 RDI: 00000000200ec000 RBP: 00007f62cf8ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f62cf9abf80 R15: 00007ffcfee56288 Allocated by task 5171: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] xpad_probe+0x27e/0x1f50 drivers/input/joystick/xpad.c:2021 usb_probe_interface+0x309/0x9d0 drivers/usb/core/driver.c:399 call_driver_probe drivers/base/dd.c:578 [inline] really_probe+0x23e/0xa90 drivers/base/dd.c:656 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:828 __device_attach_driver+0x1df/0x310 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:532 device_add+0x1188/0x1ab0 drivers/base/core.c:3720 usb_set_configuration+0x10cb/0x1c50 drivers/usb/core/message.c:2210 usb_generic_driver_probe+0xb1/0x110 drivers/usb/core/generic.c:254 usb_probe_device+0xec/0x3e0 drivers/usb/core/driver.c:294 call_driver_probe drivers/base/dd.c:578 [inline] really_probe+0x23e/0xa90 drivers/base/dd.c:656 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:798 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:828 __device_attach_driver+0x1df/0x310 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:532 device_add+0x1188/0x1ab0 drivers/base/core.c:3720 usb_new_device+0xd90/0x1a10 drivers/usb/core/hub.c:2652 hub_port_connect drivers/usb/core/hub.c:5521 [inline] hub_port_connect_change drivers/usb/core/hub.c:5661 [inline] port_event drivers/usb/core/hub.c:5821 [inline] hub_event+0x2db0/0x4e20 drivers/usb/core/hub.c:5903 process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 24392: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:240 [inline] __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x129/0x390 mm/slub.c:4390 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2202 usb_unbind_interface+0x1e8/0x970 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:568 [inline] device_remove+0x122/0x170 drivers/base/dd.c:560 __device_release_driver drivers/base/dd.c:1270 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1293 bus_remove_device+0x22f/0x420 drivers/base/bus.c:574 device_del+0x396/0xa10 drivers/base/core.c:3909 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1418 usb_disconnect+0x2e1/0x920 drivers/usb/core/hub.c:2305 hub_port_connect drivers/usb/core/hub.c:5361 [inline] hub_port_connect_change drivers/usb/core/hub.c:5661 [inline] port_event drivers/usb/core/hub.c:5821 [inline] hub_event+0x1dbb/0x4e20 drivers/usb/core/hub.c:5903 process_one_work+0x9a9/0x1ac0 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x6c8/0xf70 kernel/workqueue.c:3416 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff888023261800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff888023261800, ffff888023261c00) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888023260800 pfn:0x23260 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff80000000a40(workingset|slab|head|node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000a40 ffff888015041dc0 ffffea0001834c10 ffffea0001f2aa10 raw: ffff888023260800 000000000010000f 00000001ffffffff 0000000000000000 head: 00fff80000000a40 ffff888015041dc0 ffffea0001834c10 ffffea0001f2aa10 head: ffff888023260800 000000000010000f 00000001ffffffff 0000000000000000 head: 00fff80000000003 ffffea00008c9801 ffffea00008c9848 00000000ffffffff head: 0000000800000000 0000000000000000 00000000ffffffff 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5196, tgid -2097656227 (syz-executor.3), ts 5197, free_ts 121985684387 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc+0x3b4/0x440 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] alloc_workqueue+0xdfb/0x1c90 kernel/workqueue.c:5542 btrfs_init_workqueues fs/btrfs/disk-io.c:2000 [inline] open_ctree+0x1575/0x52f0 fs/btrfs/disk-io.c:3354 btrfs_fill_super fs/btrfs/super.c:938 [inline] btrfs_get_tree_super fs/btrfs/super.c:1858 [inline] btrfs_get_tree+0x11e9/0x1b90 fs/btrfs/super.c:2084 vfs_get_tree+0x8f/0x380 fs/super.c:1779 fc_mount+0x16/0xc0 fs/namespace.c:1125 btrfs_get_tree_subvol fs/btrfs/super.c:2047 [inline] btrfs_get_tree+0xa53/0x1b90 fs/btrfs/super.c:2085 vfs_get_tree+0x8f/0x380 fs/super.c:1779 do_new_mount fs/namespace.c:3352 [inline] path_mount+0x14e6/0x1f20 fs/namespace.c:3679 do_mount fs/namespace.c:3692 [inline] __do_sys_mount fs/namespace.c:3898 [inline] __se_sys_mount fs/namespace.c:3875 [inline] __x64_sys_mount+0x297/0x320 fs/namespace.c:3875 page last free pid 4524 tgid 4524 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 __put_partials+0x14c/0x170 mm/slub.c:2906 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x136/0x320 mm/slub.c:3852 getname_flags.part.0+0x50/0x4f0 fs/namei.c:139 getname_flags include/linux/audit.h:322 [inline] getname+0x8f/0xe0 fs/namei.c:218 do_sys_openat2+0x104/0x1e0 fs/open.c:1400 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888023261700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888023261780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888023261800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888023261880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888023261900: 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 56 1f 8d f6 call 0xf68d1f69 13: 48 89 df mov %rbx,%rdi 16: e8 ae 9b 8d f6 call 0xf68d9bc9 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 75 d9 7e f6 call 0xf67ed9a9 34: 65 8b 05 56 1c 25 75 mov %gs:0x75251c56(%rip),%eax # 0x75251c91 3b: 85 c0 test %eax,%eax 3d: 74 16 je 0x55 3f: 5b pop %rbx