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 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff88807d96405c by task udevd/6330 CPU: 0 PID: 6330 Comm: udevd Not tainted 6.6.0-rc2-syzkaller-00278-gdc912ba91b7e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/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 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x26f/0x2b0 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x50 kernel/locking/spinlock.c:162 __wake_up_common_lock+0xbb/0x140 kernel/sched/wait.c:137 __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/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x19e/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:1074 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:lock_acquire+0x201/0x510 kernel/locking/lockdep.c:5757 Code: c4 02 0f 85 9b 02 00 00 48 85 ed 74 01 fb 48 b8 00 00 00 00 00 fc ff df 48 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 <48> 8b 84 24 a8 00 00 00 65 48 2b 04 25 28 00 00 00 0f 85 a2 02 00 RSP: 0018:ffffc90004787b80 EFLAGS: 00000286 RAX: dffffc0000000000 RBX: fffff520008f0f72 RCX: 0000000000000001 RDX: 1ffff11005083c80 RSI: ffffffff8a8cae20 RDI: ffffffff8ae92e60 RBP: 0000000000000200 R08: 0000000000000000 R09: fffffbfff233ddd1 R10: ffffffff919eee8f R11: 0000000000000000 R12: 0000000000000001 R13: 0000000000000000 R14: ffff888014a6f9e0 R15: 0000000000000000 down_read+0x9c/0x470 kernel/locking/rwsem.c:1520 kernfs_iop_getattr+0xe8/0x150 fs/kernfs/inode.c:191 vfs_getattr_nosec+0x290/0x380 fs/stat.c:135 vfs_getattr fs/stat.c:172 [inline] vfs_fstat+0x75/0xc0 fs/stat.c:194 vfs_fstatat+0x130/0x140 fs/stat.c:291 __do_sys_newfstatat+0x98/0x110 fs/stat.c:459 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:0x7fc722f165f4 Code: 64 c7 00 09 00 00 00 83 c8 ff c3 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 00 00 00 00 41 89 ca b8 06 01 00 00 0f 05 <45> 31 c0 3d 00 f0 ff ff 76 10 48 8b 15 03 a8 0d 00 f7 d8 41 83 c8 RSP: 002b:00007fff794bb358 EFLAGS: 00000202 ORIG_RAX: 0000000000000106 RAX: ffffffffffffffda RBX: 00007fc722fee460 RCX: 00007fc722f165f4 RDX: 00007fff794bb360 RSI: 00007fc722fb3130 RDI: 0000000000000008 RBP: 000055dd236e74b0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000001000 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000003fff R14: 00007fff794bb8f8 R15: 000000000000000a Allocated by task 32697: 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+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] xpad_probe+0x27e/0x1f40 drivers/input/joystick/xpad.c:2000 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: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:3624 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2207 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: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:3624 usb_new_device+0xd80/0x1960 drivers/usb/core/hub.c:2589 hub_port_connect drivers/usb/core/hub.c:5440 [inline] hub_port_connect_change drivers/usb/core/hub.c:5580 [inline] port_event drivers/usb/core/hub.c:5740 [inline] hub_event+0x2daf/0x4e00 drivers/usb/core/hub.c:5822 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 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:304 Freed by task 30419: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 xpad_disconnect+0x1cf/0x580 drivers/input/joystick/xpad.c:2181 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: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:3813 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1416 usb_disconnect+0x2e1/0x890 drivers/usb/core/hub.c:2252 hub_port_connect drivers/usb/core/hub.c:5280 [inline] hub_port_connect_change drivers/usb/core/hub.c:5580 [inline] port_event drivers/usb/core/hub.c:5740 [inline] hub_event+0x1db7/0x4e00 drivers/usb/core/hub.c:5822 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 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:304 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 batadv_hardif_release+0xa4/0xd0 net/batman-adv/hard-interface.c:56 kref_put include/linux/kref.h:65 [inline] batadv_hardif_put net/batman-adv/hard-interface.h:95 [inline] batadv_hardif_put net/batman-adv/hard-interface.h:90 [inline] batadv_hard_if_event+0x114d/0x1660 net/batman-adv/hard-interface.c:1020 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers net/core/dev.c:2022 [inline] unregister_netdevice_many_notify+0x85f/0x1a20 net/core/dev.c:10938 rtnl_newlink_create net/core/rtnetlink.c:3516 [inline] __rtnl_newlink+0x1575/0x1940 net/core/rtnetlink.c:3705 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718 rtnetlink_rcv_msg+0x3c4/0xdf0 net/core/rtnetlink.c:6444 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline] netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:753 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2541 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2595 __sys_sendmsg+0x117/0x1e0 net/socket.c:2624 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 neigh_destroy+0x435/0x670 net/core/neighbour.c:910 neigh_release include/net/neighbour.h:445 [inline] neigh_cleanup_and_release+0x1fe/0x280 net/core/neighbour.c:103 neigh_flush_dev+0x4e0/0x8b0 net/core/neighbour.c:421 __neigh_ifdown.isra.0+0x54/0x400 net/core/neighbour.c:438 neigh_ifdown+0x1e/0x30 net/core/neighbour.c:456 rt6_disable_ip+0x295/0xa00 net/ipv6/route.c:4899 addrconf_ifdown.isra.0+0x112/0x1c50 net/ipv6/addrconf.c:3792 addrconf_notify+0x22d/0x1920 net/ipv6/addrconf.c:3715 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers net/core/dev.c:2022 [inline] dev_close_many+0x305/0x640 net/core/dev.c:1563 unregister_netdevice_many_notify+0x41b/0x1a20 net/core/dev.c:10911 rtnl_delete_link net/core/rtnetlink.c:3227 [inline] rtnl_dellink+0x3c1/0xae0 net/core/rtnetlink.c:3279 rtnetlink_rcv_msg+0x3c4/0xdf0 net/core/rtnetlink.c:6444 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline] netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368 netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:753 ____sys_sendmsg+0x6ac/0x940 net/socket.c:2541 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2595 __sys_sendmsg+0x117/0x1e0 net/socket.c:2624 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff88807d964000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff88807d964000, ffff88807d964400) The buggy address belongs to the physical page: page:ffffea0001f65800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d960 head:ffffea0001f65800 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 ffff888012c41dc0 ffffea0000a23400 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5057, tgid 5057 (kworker/0:4), ts 573701648361, free_ts 573648066068 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] kzalloc include/linux/slab.h:720 [inline] ieee802_11_parse_elems_full+0xc7/0x1380 net/mac80211/util.c:1602 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2326 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2333 [inline] ieee80211_inform_bss+0x120/0x1150 net/mac80211/scan.c:79 rdev_inform_bss+0xea/0x420 net/wireless/rdev-ops.h:418 cfg80211_inform_single_bss_frame_data+0x82d/0xf30 net/wireless/scan.c:2885 cfg80211_inform_bss_frame_data+0xbf/0x290 net/wireless/scan.c:2912 ieee80211_bss_info_update+0x374/0x990 net/mac80211/scan.c:211 ieee80211_rx_bss_info net/mac80211/ibss.c:1124 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1613 [inline] ieee80211_ibss_rx_queued_mgmt+0x1958/0x2ed0 net/mac80211/ibss.c:1642 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x195/0x340 mm/slub.c:3517 kmalloc_node_trace+0x22/0xd0 mm/slab_common.c:1127 kmalloc_node include/linux/slab.h:615 [inline] kzalloc_node include/linux/slab.h:731 [inline] __get_vm_area_node+0xe1/0x3d0 mm/vmalloc.c:2588 __vmalloc_node_range+0x27a/0x1540 mm/vmalloc.c:3280 __vmalloc_node mm/vmalloc.c:3385 [inline] vzalloc+0x6b/0x80 mm/vmalloc.c:3458 xt_counters_alloc+0x4c/0x70 net/netfilter/x_tables.c:1379 __do_replace+0x9a/0x9b0 net/ipv4/netfilter/ip_tables.c:1046 compat_do_replace.constprop.0+0x2d8/0x4a0 net/ipv4/netfilter/ip_tables.c:1521 do_ipt_set_ctl+0x5e4/0xbb0 net/ipv4/netfilter/ip_tables.c:1624 nf_setsockopt+0x87/0xe0 net/netfilter/nf_sockopt.c:101 ip_setsockopt+0xc7/0xe0 net/ipv4/ip_sockglue.c:1429 Memory state around the buggy address: ffff88807d963f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807d963f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807d964000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807d964080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d964100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 02 0f add (%rdi),%cl 2: 85 9b 02 00 00 48 test %ebx,0x48000002(%rbx) 8: 85 ed test %ebp,%ebp a: 74 01 je 0xd c: fb sti d: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 14: fc ff df 17: 48 01 c3 add %rax,%rbx 1a: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 21: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx) 28: 00 * 29: 48 8b 84 24 a8 00 00 mov 0xa8(%rsp),%rax <-- trapping instruction 30: 00 31: 65 48 2b 04 25 28 00 sub %gs:0x28,%rax 38: 00 00 3a: 0f .byte 0xf 3b: 85 .byte 0x85 3c: a2 .byte 0xa2 3d: 02 00 add (%rax),%al