xpad 1-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 1-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in register_lock_class+0x101b/0x1230 kernel/locking/lockdep.c:1333 Read of size 1 at addr ffff88804c5df091 by task syz-executor.0/5105 CPU: 1 PID: 5105 Comm: syz-executor.0 Not tainted 6.8.0-rc2-syzkaller-00043-g2a6526c4f389 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/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:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 register_lock_class+0x101b/0x1230 kernel/locking/lockdep.c:1333 __lock_acquire+0x112/0x3b30 kernel/locking/lockdep.c:5014 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:105 [inline] __wake_up+0x1c/0x50 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+0x384/0x5c0 drivers/usb/core/hcd.c:1653 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1733 dummy_timer+0x1415/0x3600 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x193/0x590 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x759/0xaa0 kernel/time/timer.c:2038 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2051 __do_softirq+0x21a/0x8de 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+0x95/0xb0 arch/x86/kernel/apic/apic.c:1076 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__orc_find+0x1b/0x130 arch/x86/kernel/unwind_orc.c:85 Code: 48 89 fb e8 d7 eb 4d 00 48 8b 03 5b c3 66 90 41 57 41 56 49 89 fe 41 55 41 54 49 89 cc 55 53 89 d3 48 83 ec 18 48 89 7c 24 10 <48> 89 74 24 08 e8 ab eb 4d 00 89 d8 31 ff 89 de 49 8d 6c 86 fc e8 RSP: 0018:ffffc90003e1f8f8 EFLAGS: 00000292 RAX: 0000000000037510 RBX: 0000000000000005 RCX: ffffffff81f694fe RDX: 0000000000000005 RSI: ffffffff8fd53bc0 RDI: ffffffff8f549be0 RBP: 0000000000000001 R08: 0000000000000004 R09: 000000000000f694 R10: 000000000009c000 R11: 0000000000000003 R12: ffffffff81f694fe R13: ffffffff8fd53bc0 R14: ffffffff8f549be0 R15: ffffc90003e1f9fd orc_find arch/x86/kernel/unwind_orc.c:227 [inline] unwind_next_frame+0x329/0x2390 arch/x86/kernel/unwind_orc.c:494 arch_stack_walk+0xfa/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x96/0xd0 kernel/stacktrace.c:122 kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 __kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:586 __call_rcu_common.constprop.0+0x9a/0x7b0 kernel/rcu/tree.c:2715 dentry_free+0xc2/0x160 fs/dcache.c:376 __dentry_kill+0x48b/0x5f0 fs/dcache.c:622 dput.part.0+0x4ac/0x9a0 fs/dcache.c:845 dput+0x1f/0x30 fs/dcache.c:835 do_rmdir+0x2d2/0x410 fs/namei.c:4266 __do_sys_unlinkat fs/namei.c:4440 [inline] __se_sys_unlinkat fs/namei.c:4434 [inline] __x64_sys_unlinkat+0xef/0x130 fs/namei.c:4434 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd3/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7ff24107d587 Code: 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 07 01 00 00 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:00007ff2412cec68 EFLAGS: 00000207 ORIG_RAX: 0000000000000107 RAX: ffffffffffffffda RBX: 0000000000000065 RCX: 00007ff24107d587 RDX: 0000000000000200 RSI: 00007ff2412cfde0 RDI: 00000000ffffff9c RBP: 00007ff2410c93b9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000207 R12: 00007ff2412cfde0 R13: 00007ff2410c93b9 R14: 00000000001274db R15: 000000000000000a Allocated by task 5144: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:389 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] xpad_probe+0x27e/0x1f40 drivers/input/joystick/xpad.c:2005 usb_probe_interface+0x307/0x930 drivers/usb/core/driver.c:399 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:3625 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2207 usb_generic_driver_probe+0xad/0x110 drivers/usb/core/generic.c:254 usb_probe_device+0xec/0x350 drivers/usb/core/driver.c:294 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:3625 usb_new_device+0xd80/0x19f0 drivers/usb/core/hub.c:2596 hub_port_connect drivers/usb/core/hub.c:5465 [inline] hub_port_connect_change drivers/usb/core/hub.c:5605 [inline] port_event drivers/usb/core/hub.c:5765 [inline] hub_event+0x2dac/0x4e10 drivers/usb/core/hub.c:5847 process_one_work+0x886/0x15d0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x2c6/0x3a0 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:242 Freed by task 15309: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x121/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x124/0x360 mm/slub.c:4409 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2186 usb_unbind_interface+0x1dd/0x8d0 drivers/usb/core/driver.c:461 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:3814 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1416 usb_disconnect+0x2e1/0x910 drivers/usb/core/hub.c:2257 hub_port_connect drivers/usb/core/hub.c:5305 [inline] hub_port_connect_change drivers/usb/core/hub.c:5605 [inline] port_event drivers/usb/core/hub.c:5765 [inline] hub_event+0x1db7/0x4e10 drivers/usb/core/hub.c:5847 process_one_work+0x886/0x15d0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x2c6/0x3a0 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:242 The buggy address belongs to the object at ffff88804c5df000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff88804c5df000, ffff88804c5df400) The buggy address belongs to the physical page: page:ffffea0001317600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4c5d8 head:ffffea0001317600 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 ffff888013041dc0 ffffea0000854600 dead000000000002 raw: 0000000000000000 0000000000100010 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5107, tgid 5107 (syz-executor.3), ts 170666976023, free_ts 21751341998 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311 __alloc_pages+0x22f/0x2440 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2407 ___slab_alloc+0x4af/0x19a0 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmalloc_trace+0x30b/0x340 mm/slub.c:4007 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] rxrpc_alloc_connection+0x8b/0x6c0 net/rxrpc/conn_object.c:62 rxrpc_prealloc_service_connection+0x26/0x380 net/rxrpc/conn_service.c:123 rxrpc_service_prealloc_one+0x2bf/0xe90 net/rxrpc/call_accept.c:87 rxrpc_kernel_charge_accept+0xd7/0x120 net/rxrpc/call_accept.c:475 afs_charge_preallocation+0xce/0x330 fs/afs/rxrpc.c:712 afs_open_socket+0x2b3/0x370 fs/afs/rxrpc.c:94 afs_net_init+0x98a/0xc80 fs/afs/main.c:124 ops_init+0xb9/0x650 net/core/net_namespace.c:136 setup_net+0x422/0xa40 net/core/net_namespace.c:339 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x51f/0xb10 mm/page_alloc.c:2346 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2486 free_contig_range+0xb6/0x190 mm/page_alloc.c:6535 destroy_args+0xa69/0xe40 mm/debug_vm_pgtable.c:1028 debug_vm_pgtable+0x16fe/0x3250 mm/debug_vm_pgtable.c:1408 do_one_initcall+0x11c/0x650 init/main.c:1236 do_initcall_level init/main.c:1298 [inline] do_initcalls init/main.c:1314 [inline] do_basic_setup init/main.c:1333 [inline] kernel_init_freeable+0x687/0xc10 init/main.c:1551 kernel_init+0x1c/0x2a0 init/main.c:1441 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Memory state around the buggy address: ffff88804c5def80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804c5df000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804c5df080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804c5df100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804c5df180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 48 89 fb mov %rdi,%rbx 3: e8 d7 eb 4d 00 call 0x4debdf 8: 48 8b 03 mov (%rbx),%rax b: 5b pop %rbx c: c3 ret d: 66 90 xchg %ax,%ax f: 41 57 push %r15 11: 41 56 push %r14 13: 49 89 fe mov %rdi,%r14 16: 41 55 push %r13 18: 41 54 push %r12 1a: 49 89 cc mov %rcx,%r12 1d: 55 push %rbp 1e: 53 push %rbx 1f: 89 d3 mov %edx,%ebx 21: 48 83 ec 18 sub $0x18,%rsp 25: 48 89 7c 24 10 mov %rdi,0x10(%rsp) * 2a: 48 89 74 24 08 mov %rsi,0x8(%rsp) <-- trapping instruction 2f: e8 ab eb 4d 00 call 0x4debdf 34: 89 d8 mov %ebx,%eax 36: 31 ff xor %edi,%edi 38: 89 de mov %ebx,%esi 3a: 49 8d 6c 86 fc lea -0x4(%r14,%rax,4),%rbp 3f: e8 .byte 0xe8