xpad 5-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19 xpad 5-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19 ================================================================== BUG: KASAN: slab-use-after-free in register_lock_class+0x1177/0x1320 kernel/locking/lockdep.c:1341 Read of size 1 at addr ffff88809a740091 by task sshd/5000 CPU: 1 PID: 5000 Comm: sshd Not tainted 6.5.0-rc3-syzkaller-00123-g57012c57536f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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 register_lock_class+0x1177/0x1320 kernel/locking/lockdep.c:1341 __lock_acquire+0x13c/0x5de0 kernel/locking/lockdep.c:5021 lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 __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+0xbb/0x140 kernel/sched/wait.c:137 usb_anchor_resume_wakeups drivers/usb/core/urb.c:960 [inline] usb_anchor_resume_wakeups+0xc2/0xe0 drivers/usb/core/urb.c:953 __usb_hcd_giveback_urb+0x384/0x5c0 drivers/usb/core/hcd.c:1674 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1754 dummy_timer+0x1415/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a0/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:1109 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:__rcu_read_unlock+0xe1/0x570 kernel/rcu/tree_plugin.h:429 Code: 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 c3 01 00 00 8b 85 40 04 00 00 85 c0 75 54 65 48 8b 1c 25 c0 b9 03 00 48 8d bb 3c 04 00 00 <48> b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 14 02 48 RSP: 0018:ffffc9000359fa98 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffff888073132180 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff81e332e0 RDI: ffff8880731325bc RBP: ffff888073132180 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000094000 R12: ffff888073132180 R13: ffffea0005300c00 R14: 0000000000000000 R15: 0000000000000000 rcu_read_unlock include/linux/rcupdate.h:781 [inline] page_ext_put+0x35/0xd0 mm/page_ext.c:192 page_table_check_free include/linux/page_table_check.h:46 [inline] free_pages_prepare mm/page_alloc.c:1162 [inline] free_unref_page_prepare+0x4f8/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 __folio_put_small mm/swap.c:106 [inline] __folio_put+0xc5/0x140 mm/swap.c:129 folio_put include/linux/mm.h:1423 [inline] put_page include/linux/mm.h:1492 [inline] anon_pipe_buf_release+0x3fa/0x4b0 fs/pipe.c:138 pipe_buf_release include/linux/pipe_fs_i.h:203 [inline] pipe_read+0x635/0x1270 fs/pipe.c:324 call_read_iter include/linux/fs.h:1865 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x7ef/0x930 fs/read_write.c:470 ksys_read+0x1f0/0x250 fs/read_write.c:613 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fbda4d16b6a Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fffe506fd38 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 0000000000008000 RCX: 00007fbda4d16b6a RDX: 0000000000008000 RSI: 000055be84878cf0 RDI: 0000000000000007 RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 000055be8485b5d0 R15: 000055be84870e90 Allocated by task 15303: 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+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] xpad_probe+0x27e/0x1f40 drivers/input/joystick/xpad.c:1975 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:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x11f1/0x1b40 drivers/base/core.c:3625 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2211 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:798 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:828 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:956 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1028 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x11f1/0x1b40 drivers/base/core.c:3625 usb_new_device+0xd80/0x1960 drivers/usb/core/hub.c:2590 hub_port_connect drivers/usb/core/hub.c:5422 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x307f/0x5230 drivers/usb/core/hub.c:5808 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2597 worker_thread+0x687/0x1110 kernel/workqueue.c:2748 kthread+0x33a/0x430 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:296 Freed by task 15857: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13f/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2156 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:1270 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1293 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x39a/0xa40 drivers/base/core.c:3814 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1420 usb_disconnect+0x2e1/0x890 drivers/usb/core/hub.c:2253 hub_port_connect drivers/usb/core/hub.c:5261 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x21bd/0x5230 drivers/usb/core/hub.c:5808 process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2597 worker_thread+0x687/0x1110 kernel/workqueue.c:2748 kthread+0x33a/0x430 kernel/kthread.c:389 ret_from_fork+0x2c/0x70 arch/x86/kernel/process.c:145 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:296 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2649 qdisc_put+0xd1/0xf0 net/sched/sch_generic.c:1090 dev_shutdown+0x1ce/0x430 net/sched/sch_generic.c:1478 unregister_netdevice_many_notify+0x5bd/0x19a0 net/core/dev.c:10840 unregister_netdevice_many net/core/dev.c:10906 [inline] unregister_netdevice_queue+0x2e5/0x3c0 net/core/dev.c:10786 unregister_netdevice include/linux/netdevice.h:3112 [inline] __tun_detach+0x116f/0x1470 drivers/net/tun.c:684 tun_detach drivers/net/tun.c:700 [inline] tun_chr_close+0xc8/0x240 drivers/net/tun.c:3491 __fput+0x3fd/0xac0 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88809a740000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of freed 1024-byte region [ffff88809a740000, ffff88809a740400) The buggy address belongs to the physical page: page:ffffea000269d000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9a740 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x2() raw: 00fff00000000200 ffff888012840700 ffffea0002947410 ffffea0002a01c10 raw: 0000000000000000 ffff88809a740000 0000000100000002 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1797, tgid 1793 (syz-executor.1), ts 2826258835029, free_ts 2826150708067 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages_slowpath.constprop.0+0x2dd/0x2360 mm/page_alloc.c:4011 __alloc_pages+0x411/0x4a0 mm/page_alloc.c:4490 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c9/0x470 mm/slab.c:3521 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:703 [inline] alloc_workqueue+0x81d/0x10d0 kernel/workqueue.c:4646 __ext4_fill_super fs/ext4/super.c:5455 [inline] ext4_fill_super+0x6428/0xaf30 fs/ext4/super.c:5696 get_tree_bdev+0x43e/0x7d0 fs/super.c:1318 vfs_get_tree+0x88/0x350 fs/super.c:1519 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page_list+0xe6/0xb30 mm/page_alloc.c:2489 release_pages+0x32a/0x14e0 mm/swap.c:1042 tlb_batch_pages_flush+0x9a/0x190 mm/mmu_gather.c:97 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu mm/mmu_gather.c:299 [inline] tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391 exit_mmap+0x2db/0x960 mm/mmap.c:3214 __mmput+0x12a/0x4d0 kernel/fork.c:1348 mmput+0x62/0x70 kernel/fork.c:1370 exit_mm kernel/exit.c:567 [inline] do_exit+0x9b4/0x2a20 kernel/exit.c:861 do_group_exit+0xd4/0x2a0 kernel/exit.c:1024 get_signal+0x23ea/0x2770 kernel/signal.c:2881 arch_do_signal_or_restart+0x89/0x5f0 arch/x86/kernel/signal.c:308 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x11f/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88809a73ff80: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88809a740000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88809a740080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809a740100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809a740180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 83 c0 03 add $0x3,%eax 3: 38 d0 cmp %dl,%al 5: 7c 08 jl 0xf 7: 84 d2 test %dl,%dl 9: 0f 85 c3 01 00 00 jne 0x1d2 f: 8b 85 40 04 00 00 mov 0x440(%rbp),%eax 15: 85 c0 test %eax,%eax 17: 75 54 jne 0x6d 19: 65 48 8b 1c 25 c0 b9 mov %gs:0x3b9c0,%rbx 20: 03 00 22: 48 8d bb 3c 04 00 00 lea 0x43c(%rbx),%rdi * 29: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction 30: fc ff df 33: 48 89 fa mov %rdi,%rdx 36: 48 c1 ea 03 shr $0x3,%rdx 3a: 0f b6 14 02 movzbl (%rdx,%rax,1),%edx 3e: 48 rex.W