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: use-after-free in register_lock_class+0x8e8/0x990 kernel/locking/lockdep.c:1331 Read of size 1 at addr ffff88807dfb5891 by task syz-executor/3548 CPU: 0 PID: 3548 Comm: syz-executor Not tainted 6.1.100-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 register_lock_class+0x8e8/0x990 kernel/locking/lockdep.c:1331 __lock_acquire+0xd3/0x1f80 kernel/locking/lockdep.c:4928 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:137 [inline] __wake_up+0xfd/0x1c0 kernel/sched/wait.c:160 __usb_hcd_giveback_urb+0x3a8/0x530 drivers/usb/core/hcd.c:1678 dummy_timer+0x8ad/0x3200 drivers/usb/gadget/udc/dummy_hcd.c:1988 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1504 expire_timers kernel/time/timer.c:1549 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1820 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1833 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571 __do_softirq kernel/softirq.c:605 [inline] invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:654 irq_exit_rcu+0x5/0x20 kernel/softirq.c:666 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:653 RIP: 0010:lock_acquire+0x26f/0x5a0 kernel/locking/lockdep.c:5666 Code: 2b 00 74 08 4c 89 f7 e8 cf b2 77 00 f6 44 24 61 02 0f 85 84 01 00 00 41 f7 c7 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 44 25 00 00 00 00 00 43 c7 44 25 09 00 00 00 00 43 c7 44 25 RSP: 0018:ffffc90003cff320 EFLAGS: 00000206 RAX: 0000000000000001 RBX: 1ffff9200079fe70 RCX: ffffffff816b2732 RDX: dffffc0000000000 RSI: ffffffff8aec13c0 RDI: ffffffff8b3d48a0 RBP: ffffc90003cff470 R08: dffffc0000000000 R09: fffffbfff2093847 R10: 0000000000000000 R11: dffffc0000000001 R12: 1ffff9200079fe6c R13: dffffc0000000000 R14: ffffc90003cff380 R15: 0000000000000246 fs_reclaim_acquire+0xaa/0x120 mm/page_alloc.c:4691 might_alloc include/linux/sched/mm.h:271 [inline] slab_pre_alloc_hook+0x2a/0x300 mm/slab.h:710 slab_alloc_node mm/slub.c:3318 [inline] __kmem_cache_alloc_node+0x47/0x260 mm/slub.c:3437 kmalloc_node_trace+0x23/0xe0 mm/slab_common.c:1058 kmalloc_node include/linux/slab.h:578 [inline] kzalloc_node include/linux/slab.h:703 [inline] __get_vm_area_node+0x126/0x360 mm/vmalloc.c:2498 __vmalloc_node_range+0x389/0x1490 mm/vmalloc.c:3200 __vmalloc_node mm/vmalloc.c:3305 [inline] vzalloc+0x75/0x80 mm/vmalloc.c:3378 alloc_counters+0xd0/0x7b0 net/ipv4/netfilter/ip_tables.c:801 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:839 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1041 [inline] do_ip6t_get_ctl+0xeac/0x18a0 net/ipv6/netfilter/ip6_tables.c:1679 nf_getsockopt+0x28e/0x2b0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x259/0x370 net/ipv6/ipv6_sockglue.c:1513 tcp_getsockopt+0x15c/0x1c0 net/ipv4/tcp.c:4449 __sys_getsockopt+0x2b2/0x5d0 net/socket.c:2327 __do_sys_getsockopt net/socket.c:2342 [inline] __se_sys_getsockopt net/socket.c:2339 [inline] __x64_sys_getsockopt+0xb1/0xc0 net/socket.c:2339 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f7b86d7779a Code: ff c3 66 0f 1f 44 00 00 48 c7 c2 a8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb b8 0f 1f 44 00 00 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 06 c3 0f 1f 44 00 00 48 c7 c2 a8 ff ff ff f7 RSP: 002b:00007ffc5fb98ce8 EFLAGS: 00000216 ORIG_RAX: 0000000000000037 RAX: ffffffffffffffda RBX: 00007ffc5fb98d70 RCX: 00007f7b86d7779a RDX: 0000000000000041 RSI: 0000000000000029 RDI: 0000000000000003 RBP: 0000000000000003 R08: 00007ffc5fb98d0c R09: 0079746972756365 R10: 00007ffc5fb98d70 R11: 0000000000000216 R12: 00007f7b86ed0340 R13: 00007ffc5fb98d0c R14: 0000000000000000 R15: 00007f7b86ed1e40 Allocated by task 152: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:692 [inline] xpad_probe+0x3be/0x1b10 drivers/input/joystick/xpad.c:1965 usb_probe_interface+0x5c0/0xaf0 drivers/usb/core/driver.c:396 really_probe+0x2ab/0xcb0 drivers/base/dd.c:639 __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785 driver_probe_device+0x50/0x420 drivers/base/dd.c:815 __device_attach_driver+0x2cf/0x510 drivers/base/dd.c:943 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427 __device_attach+0x359/0x570 drivers/base/dd.c:1015 bus_probe_device+0xba/0x1e0 drivers/base/bus.c:487 device_add+0xb48/0xfd0 drivers/base/core.c:3689 usb_set_configuration+0x19dd/0x2020 drivers/usb/core/message.c:2165 usb_generic_driver_probe+0x84/0x140 drivers/usb/core/generic.c:238 usb_probe_device+0x130/0x260 drivers/usb/core/driver.c:293 really_probe+0x2ab/0xcb0 drivers/base/dd.c:639 __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:785 driver_probe_device+0x50/0x420 drivers/base/dd.c:815 __device_attach_driver+0x2cf/0x510 drivers/base/dd.c:943 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427 __device_attach+0x359/0x570 drivers/base/dd.c:1015 bus_probe_device+0xba/0x1e0 drivers/base/bus.c:487 device_add+0xb48/0xfd0 drivers/base/core.c:3689 usb_new_device+0xbdd/0x18f0 drivers/usb/core/hub.c:2620 hub_port_connect drivers/usb/core/hub.c:5477 [inline] hub_port_connect_change drivers/usb/core/hub.c:5617 [inline] port_event drivers/usb/core/hub.c:5773 [inline] hub_event+0x2efe/0x5730 drivers/usb/core/hub.c:5855 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 22: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674 xpad_disconnect+0x355/0x480 drivers/input/joystick/xpad.c:2146 usb_unbind_interface+0x1cd/0x840 drivers/usb/core/driver.c:458 device_remove drivers/base/dd.c:550 [inline] __device_release_driver drivers/base/dd.c:1260 [inline] device_release_driver_internal+0x59e/0x880 drivers/base/dd.c:1286 bus_remove_device+0x2e5/0x400 drivers/base/bus.c:529 device_del+0x6e2/0xbd0 drivers/base/core.c:3877 usb_disable_device+0x3b8/0x840 drivers/usb/core/message.c:1414 usb_disconnect+0x33c/0x8c0 drivers/usb/core/hub.c:2275 hub_port_connect drivers/usb/core/hub.c:5321 [inline] hub_port_connect_change drivers/usb/core/hub.c:5617 [inline] port_event drivers/usb/core/hub.c:5773 [inline] hub_event+0x1f78/0x5730 drivers/usb/core/hub.c:5855 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88807dfb5800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 145 bytes inside of 1024-byte region [ffff88807dfb5800, ffff88807dfb5c00) The buggy address belongs to the physical page: page:ffffea0001f7ec00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7dfb0 head:ffffea0001f7ec00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888012441dc0 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 2991, tgid 2991 (klogd), ts 59664181233, free_ts 58647496017 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4283 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5551 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1045 kmalloc include/linux/slab.h:556 [inline] syslog_print+0x11d/0x9b0 kernel/printk/printk.c:1500 do_syslog+0x819/0x910 kernel/printk/printk.c:1679 __do_sys_syslog kernel/printk/printk.c:1771 [inline] __se_sys_syslog kernel/printk/printk.c:1769 [inline] __x64_sys_syslog+0x78/0x90 kernel/printk/printk.c:1769 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1494 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3362 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3457 __skb_frag_unref include/linux/skbuff.h:3436 [inline] skb_release_data+0x37f/0x7a0 net/core/skbuff.c:785 skb_release_all net/core/skbuff.c:856 [inline] __kfree_skb+0x4c/0x60 net/core/skbuff.c:870 tcp_clean_rtx_queue net/ipv4/tcp_input.c:3373 [inline] tcp_ack+0x246c/0x6e80 net/ipv4/tcp_input.c:3932 tcp_rcv_established+0xf53/0x1f00 net/ipv4/tcp_input.c:5963 tcp_v4_do_rcv+0x487/0xb00 net/ipv4/tcp_ipv4.c:1683 sk_backlog_rcv include/net/sock.h:1117 [inline] __release_sock+0x198/0x4b0 net/core/sock.c:2936 __sk_flush_backlog+0x22/0x30 net/core/sock.c:2956 sk_flush_backlog include/net/sock.h:1215 [inline] tcp_sendmsg_locked+0x314b/0x4100 net/ipv4/tcp.c:1327 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1489 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] sock_write_iter+0x394/0x4e0 net/socket.c:1143 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x857/0xbc0 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88807dfb5780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807dfb5800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807dfb5880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807dfb5900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807dfb5980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 2b 00 sub (%rax),%eax 2: 74 08 je 0xc 4: 4c 89 f7 mov %r14,%rdi 7: e8 cf b2 77 00 call 0x77b2db c: f6 44 24 61 02 testb $0x2,0x61(%rsp) 11: 0f 85 84 01 00 00 jne 0x19b 17: 41 f7 c7 00 02 00 00 test $0x200,%r15d 1e: 74 01 je 0x21 20: fb sti 21: 48 c7 44 24 40 0e 36 movq $0x45e0360e,0x40(%rsp) 28: e0 45 * 2a: 4b c7 44 25 00 00 00 movq $0x0,0x0(%r13,%r12,1) <-- trapping instruction 31: 00 00 33: 43 c7 44 25 09 00 00 movl $0x0,0x9(%r13,%r12,1) 3a: 00 00 3c: 43 rex.XB 3d: c7 .byte 0xc7 3e: 44 rex.R 3f: 25 .byte 0x25