xpad 3-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 3-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in register_lock_class+0x101f/0x1230 kernel/locking/lockdep.c:1332 Read of size 1 at addr ffff8881122ac091 by task sed/8062 CPU: 0 UID: 0 PID: 8062 Comm: sed Not tainted 6.11.0-rc7-syzkaller-00152-g68d4209158f4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 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 register_lock_class+0x101f/0x1230 kernel/locking/lockdep.c:1332 __lock_acquire+0x135/0x3cb0 kernel/locking/lockdep.c:5019 lock_acquire kernel/locking/lockdep.c:5759 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5724 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/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+0x3b7/0x6e0 drivers/usb/core/hcd.c:1653 usb_hcd_giveback_urb+0x396/0x450 drivers/usb/core/hcd.c:1734 dummy_timer+0x17c3/0x38d0 drivers/usb/gadget/udc/dummy_hcd.c:1988 __run_hrtimer kernel/time/hrtimer.c:1689 [inline] __hrtimer_run_queues+0x20c/0xcc0 kernel/time/hrtimer.c:1753 hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1770 handle_softirqs+0x209/0x8e0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xac/0x110 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__sanitizer_cov_trace_pc+0x66/0x70 kernel/kcov.c:234 Code: 82 30 15 00 00 83 f8 02 75 20 48 8b 8a 38 15 00 00 8b 92 34 15 00 00 48 8b 01 48 83 c0 01 48 39 d0 73 07 48 89 01 48 89 34 c1 cc cc cc cc 0f 1f 44 00 00 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 0018:ffffc900070cf910 EFLAGS: 00000293 RAX: 0000000000000000 RBX: dffffc0000000000 RCX: ffffffff81a4d9b1 RDX: ffff8881127e0000 RSI: ffffffff81a4d9c6 RDI: 0000000000000007 RBP: ffffea0004532f40 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000176 R13: ffff888111c19bc0 R14: ffffea0004532f40 R15: 0000000000000000 folio_test_swapbacked include/linux/page-flags.h:534 [inline] folio_test_swapcache include/linux/page-flags.h:576 [inline] free_swap_cache mm/swap_state.c:291 [inline] free_pages_and_swap_cache+0x246/0x510 mm/swap_state.c:325 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3d1/0xb20 mm/mmap.c:3425 __mmput kernel/fork.c:1345 [inline] mmput+0xdb/0x3e0 kernel/fork.c:1367 exit_mm kernel/exit.c:571 [inline] do_exit+0x9bf/0x2b30 kernel/exit.c:869 do_group_exit+0xd3/0x2a0 kernel/exit.c:1031 __do_sys_exit_group kernel/exit.c:1042 [inline] __se_sys_exit_group kernel/exit.c:1040 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1040 x64_sys_call+0x14a9/0x16a0 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fb87a821a90 Code: Unable to access opcode bytes at 0x7fb87a821a66. RSP: 002b:00007ffdfde67758 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007fb87a912860 RCX: 00007fb87a821a90 RDX: 00000000000000e7 RSI: 000000000000003c RDI: 0000000000000000 RBP: 00007fb87a912860 R08: 0000000000000002 R09: 604f221d084ac5e3 R10: 00007ffdfde67610 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fb87a916658 R15: 0000000000000001 Allocated by task 4932: 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+0x8f/0xa0 mm/kasan/common.c:387 kmalloc_noprof include/linux/slab.h:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] xpad_probe+0x27e/0x1f50 drivers/input/joystick/xpad.c:2026 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:657 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:799 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829 __device_attach_driver+0x1df/0x310 drivers/base/dd.c:957 bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1029 bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:532 device_add+0x114b/0x1a70 drivers/base/core.c:3682 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:657 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:799 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829 __device_attach_driver+0x1df/0x310 drivers/base/dd.c:957 bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1029 bus_probe_device+0x17f/0x1c0 drivers/base/bus.c:532 device_add+0x114b/0x1a70 drivers/base/core.c:3682 usb_new_device+0xd90/0x1a10 drivers/usb/core/hub.c:2651 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+0x2e58/0x4f40 drivers/usb/core/hub.c:5903 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 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 24: 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+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x14/0x30 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2256 [inline] slab_free mm/slub.c:4477 [inline] kfree+0x10b/0x380 mm/slub.c:4598 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2207 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:1272 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1295 bus_remove_device+0x22f/0x420 drivers/base/bus.c:574 device_del+0x396/0x9f0 drivers/base/core.c:3871 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1418 usb_disconnect+0x2e1/0x920 drivers/usb/core/hub.c:2304 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+0x1bed/0x4f40 drivers/usb/core/hub.c:5903 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 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 ffff8881122ac000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff8881122ac000, ffff8881122ac400) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1122a8 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000000040(head|node=0|zone=2) page_type: 0xfdffffff(slab) raw: 0200000000000040 ffff888100041dc0 ffffea0004b75c00 dead000000000002 raw: 0000000000000000 0000000000100010 00000001fdffffff 0000000000000000 head: 0200000000000040 ffff888100041dc0 ffffea0004b75c00 dead000000000002 head: 0000000000000000 0000000000100010 00000001fdffffff 0000000000000000 head: 0200000000000003 ffffea000448aa01 ffffffffffffffff 0000000000000000 head: 0000000000000008 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3236, tgid 3236 (kworker/u8:2), ts 60931433641, free_ts 60869839515 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x1311/0x25f0 mm/page_alloc.c:3446 __alloc_pages_noprof+0x21e/0x2290 mm/page_alloc.c:4702 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2325 allocate_slab mm/slub.c:2488 [inline] new_slab+0x84/0x260 mm/slub.c:2541 ___slab_alloc+0xdac/0x1870 mm/slub.c:3727 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3817 __slab_alloc_node mm/slub.c:3870 [inline] slab_alloc_node mm/slub.c:4029 [inline] __do_kmalloc_node mm/slub.c:4161 [inline] __kmalloc_noprof+0x325/0x3c0 mm/slub.c:4174 kmalloc_noprof include/linux/slab.h:685 [inline] load_elf_phdrs+0x103/0x210 fs/binfmt_elf.c:526 load_elf_binary+0x14ab/0x4d90 fs/binfmt_elf.c:955 search_binary_handler fs/exec.c:1827 [inline] exec_binprm fs/exec.c:1869 [inline] bprm_execve fs/exec.c:1920 [inline] bprm_execve+0x703/0x1950 fs/exec.c:1896 kernel_execve+0x2ef/0x3b0 fs/exec.c:2087 call_usermodehelper_exec_async+0x255/0x4c0 kernel/umh.c:110 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page last free pid 3231 tgid 3231 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_page+0x698/0xce0 mm/page_alloc.c:2619 __put_partials+0x14c/0x170 mm/slub.c:3055 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+0x4e/0x70 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3992 [inline] slab_alloc_node mm/slub.c:4041 [inline] kmem_cache_alloc_noprof+0x11c/0x2b0 mm/slub.c:4048 ptlock_alloc mm/memory.c:6589 [inline] ptlock_init include/linux/mm.h:2944 [inline] pmd_ptlock_init include/linux/mm.h:3048 [inline] pagetable_pmd_ctor include/linux/mm.h:3086 [inline] pmd_alloc_one_noprof include/asm-generic/pgalloc.h:141 [inline] __pmd_alloc+0x9c/0x7a0 mm/memory.c:6079 pmd_alloc include/linux/mm.h:2835 [inline] __handle_mm_fault+0xc7b/0x24f0 mm/memory.c:5624 handle_mm_fault+0x498/0xa60 mm/memory.c:5832 do_user_addr_fault+0x613/0x12c0 arch/x86/mm/fault.c:1338 handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 Memory state around the buggy address: ffff8881122abf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881122ac000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881122ac080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881122ac100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881122ac180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 30 15 00 00 83 f8 xor %dl,-0x77d0000(%rip) # 0xf8830006 6: 02 75 20 add 0x20(%rbp),%dh 9: 48 8b 8a 38 15 00 00 mov 0x1538(%rdx),%rcx 10: 8b 92 34 15 00 00 mov 0x1534(%rdx),%edx 16: 48 8b 01 mov (%rcx),%rax 19: 48 83 c0 01 add $0x1,%rax 1d: 48 39 d0 cmp %rdx,%rax 20: 73 07 jae 0x29 22: 48 89 01 mov %rax,(%rcx) 25: 48 89 34 c1 mov %rsi,(%rcx,%rax,8) * 29: c3 ret <-- trapping instruction 2a: cc int3 2b: cc int3 2c: cc int3 2d: cc int3 2e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) 33: 90 nop 34: 90 nop 35: 90 nop 36: 90 nop 37: 90 nop 38: 90 nop 39: 90 nop 3a: 90 nop 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop