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+0x8d1/0x980 kernel/locking/lockdep.c:1333 Read of size 1 at addr ffff888064742091 by task udevd/6218 CPU: 1 PID: 6218 Comm: udevd Not tainted 6.9.0-rc5-syzkaller-00031-g71b1543c83d6 #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+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 register_lock_class+0x8d1/0x980 kernel/locking/lockdep.c:1333 __lock_acquire+0xda/0x1fd0 kernel/locking/lockdep.c:5014 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162 __wake_up_common_lock+0x25/0x1e0 kernel/sched/wait.c:105 __usb_hcd_giveback_urb+0x3ac/0x530 drivers/usb/core/hcd.c:1651 dummy_timer+0x833/0x45f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x190/0x650 kernel/time/timer.c:1793 expire_timers kernel/time/timer.c:1844 [inline] __run_timers kernel/time/timer.c:2418 [inline] __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2429 run_timer_base kernel/time/timer.c:2438 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2448 __do_softirq+0x2c8/0x980 kernel/softirq.c:554 invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf2/0x1c0 kernel/softirq.c:633 irq_exit_rcu+0x9/0x30 kernel/softirq.c:645 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__read_once_word_nocheck+0xc/0x20 include/asm-generic/rwonce.h:67 Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 53 48 89 fb e8 57 8a 54 00 48 8b 03 <5b> e9 f9 c9 6e 0a 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90 90 RSP: 0018:ffffc90015e7ee38 EFLAGS: 00000293 RAX: ffffffff820fa0ab RBX: ffffc90015e7f7d8 RCX: ffff88801ab29e00 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffc90015e7f7d8 RBP: 1ffff92002bcfde6 R08: ffffffff8141500d R09: ffffffff81414f66 R10: 0000000000000003 R11: ffff88801ab29e00 R12: ffffc90015e7f7d8 R13: dffffc0000000000 R14: 1ffff92002bcfde5 R15: 1ffff92002bcfde4 deref_stack_reg arch/x86/kernel/unwind_orc.c:406 [inline] unwind_next_frame+0x1356/0x2a00 arch/x86/kernel/unwind_orc.c:585 arch_stack_walk+0x151/0x1b0 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x118/0x1d0 kernel/stacktrace.c:122 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 __call_rcu_common kernel/rcu/tree.c:2734 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:2838 __destroy_inode+0x2d9/0x650 fs/inode.c:286 destroy_inode fs/inode.c:309 [inline] evict+0x521/0x630 fs/inode.c:682 __dentry_kill+0x20d/0x630 fs/dcache.c:603 shrink_kill+0xa9/0x2c0 fs/dcache.c:1048 shrink_dentry_list+0x2c0/0x5b0 fs/dcache.c:1075 shrink_dcache_parent+0xcb/0x3b0 d_invalidate+0x11c/0x2d0 fs/dcache.c:1592 lookup_fast+0x3a6/0x4a0 fs/namei.c:1657 walk_component fs/namei.c:2000 [inline] link_path_walk+0x60b/0xea0 fs/namei.c:2331 path_openat+0x24a/0x3240 fs/namei.c:3795 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 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+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7efe5f57c9a4 Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fff96759830 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00007efe5f57c9a4 RDX: 0000000000080000 RSI: 00007fff96759968 RDI: 00000000ffffff9c RBP: 00007fff96759968 R08: 0000000000000008 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000 R13: 000055957bbedb42 R14: 0000000000000001 R15: 000055957bc09160 Allocated by task 5164: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1db/0x360 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] xpad_probe+0x3c8/0x1b90 drivers/input/joystick/xpad.c:2021 usb_probe_interface+0x647/0xbb0 drivers/usb/core/driver.c:399 really_probe+0x2ba/0xad0 drivers/base/dd.c:656 __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:798 driver_probe_device+0x50/0x430 drivers/base/dd.c:828 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:956 bus_for_each_drv+0x250/0x2e0 drivers/base/bus.c:457 __device_attach+0x333/0x520 drivers/base/dd.c:1028 bus_probe_device+0x189/0x260 drivers/base/bus.c:532 device_add+0x8ff/0xca0 drivers/base/core.c:3720 usb_set_configuration+0x1976/0x1fb0 drivers/usb/core/message.c:2210 usb_generic_driver_probe+0x88/0x140 drivers/usb/core/generic.c:254 usb_probe_device+0x1ba/0x380 drivers/usb/core/driver.c:294 really_probe+0x2ba/0xad0 drivers/base/dd.c:656 __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:798 driver_probe_device+0x50/0x430 drivers/base/dd.c:828 __device_attach_driver+0x2d6/0x530 drivers/base/dd.c:956 bus_for_each_drv+0x250/0x2e0 drivers/base/bus.c:457 __device_attach+0x333/0x520 drivers/base/dd.c:1028 bus_probe_device+0x189/0x260 drivers/base/bus.c:532 device_add+0x8ff/0xca0 drivers/base/core.c:3720 usb_new_device+0x104a/0x19a0 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+0x2d6a/0x5150 drivers/usb/core/hub.c:5903 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa12/0x17c0 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f2/0x390 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 5165: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 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+0x153/0x3a0 mm/slub.c:4390 xpad_disconnect+0x359/0x490 drivers/input/joystick/xpad.c:2202 usb_unbind_interface+0x260/0x940 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:568 [inline] __device_release_driver drivers/base/dd.c:1270 [inline] device_release_driver_internal+0x505/0x7c0 drivers/base/dd.c:1293 bus_remove_device+0x34f/0x420 drivers/base/bus.c:574 device_del+0x57a/0x9e0 drivers/base/core.c:3909 usb_disable_device+0x3bf/0x850 drivers/usb/core/message.c:1418 usb_disconnect+0x340/0x950 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+0x1eb9/0x5150 drivers/usb/core/hub.c:5903 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa12/0x17c0 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f2/0x390 kernel/kthread.c:388 ret_from_fork+0x4d/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 ffff888064742000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff888064742000, ffff888064742400) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x64740 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000840 ffff888015041dc0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 head: 00fff80000000840 ffff888015041dc0 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 head: 00fff80000000003 ffffea000191d001 dead000000000122 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5099, tgid -1717048570 (syz-executor.2), ts 5099, free_ts 24030678990 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317 __alloc_pages+0x256/0x6c0 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+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __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+0x2e5/0x4a0 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] ops_init+0x8b/0x610 net/core/net_namespace.c:126 setup_net+0x515/0xca0 net/core/net_namespace.c:340 copy_net_ns+0x4e4/0x7b0 net/core/net_namespace.c:505 create_new_namespaces+0x425/0x7b0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x124/0x180 kernel/nsproxy.c:228 ksys_unshare+0x619/0xc10 kernel/fork.c:3323 __do_sys_unshare kernel/fork.c:3394 [inline] __se_sys_unshare kernel/fork.c:3392 [inline] __x64_sys_unshare+0x38/0x40 kernel/fork.c:3392 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 1 tgid 1 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+0x986/0xab0 mm/page_alloc.c:2347 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487 free_contig_range+0x9e/0x160 mm/page_alloc.c:6572 destroy_args+0x8a/0x890 mm/debug_vm_pgtable.c:1036 debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1416 do_one_initcall+0x24a/0x880 init/main.c:1245 do_initcall_level+0x157/0x210 init/main.c:1307 do_initcalls+0x3f/0x80 init/main.c:1323 kernel_init_freeable+0x435/0x5d0 init/main.c:1555 kernel_init+0x1d/0x2b0 init/main.c:1444 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888064741f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888064742000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888064742080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888064742100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888064742180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 7: 00 00 00 a: 0f 1f 40 00 nopl 0x0(%rax) e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 53 push %rbx 1f: 48 89 fb mov %rdi,%rbx 22: e8 57 8a 54 00 call 0x548a7e 27: 48 8b 03 mov (%rbx),%rax * 2a: 5b pop %rbx <-- trapping instruction 2b: e9 f9 c9 6e 0a jmp 0xa6eca29 30: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 37: 00 00 00 3a: 0f 1f 40 00 nopl 0x0(%rax) 3e: 90 nop 3f: 90 nop