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 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x299/0x370 kernel/locking/spinlock_debug.c:115 Read of size 4 at addr ffff88802e65e05c by task syz-executor.0/11338 CPU: 1 PID: 11338 Comm: syz-executor.0 Not tainted 6.9.0-syzkaller-12255-g0b32d436c015 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/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 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline] do_raw_spin_lock+0x299/0x370 kernel/locking/spinlock_debug.c:115 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0xe1/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+0x830/0x45d0 drivers/usb/gadget/udc/dummy_hcd.c:1987 __run_hrtimer kernel/time/hrtimer.c:1687 [inline] __hrtimer_run_queues+0x59b/0xd50 kernel/time/hrtimer.c:1751 hrtimer_interrupt+0x396/0x990 kernel/time/hrtimer.c:1813 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1032 [inline] __sysvec_apic_timer_interrupt+0x110/0x3f0 arch/x86/kernel/apic/apic.c:1049 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa1/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:check_kcov_mode kernel/kcov.c:184 [inline] RIP: 0010:__sanitizer_cov_trace_pc+0x37/0x70 kernel/kcov.c:207 Code: 00 d5 03 00 65 8b 15 10 c0 6d 7e f7 c2 00 01 ff 00 74 11 f7 c2 00 01 00 00 74 35 83 b9 1c 16 00 00 00 74 2c 8b 91 f8 15 00 00 <83> fa 02 75 21 48 8b 91 00 16 00 00 48 8b 32 48 8d 7e 01 8b 89 fc RSP: 0018:ffffc90004cc67c8 EFLAGS: 00000246 RAX: ffffffff8476e789 RBX: 798c5bf600000000 RCX: ffff888017f93c00 RDX: 0000000000000002 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90004cc68d0 R08: ffffffff8476e722 R09: 0000000000000005 R10: ffffc90004cc69ad R11: fffff52000998d41 R12: 0000000000000028 R13: 0000000000000006 R14: ffffc90004cc6974 R15: ffffc90004cc68a0 crypto_sha3_final+0x2b9/0x760 crypto/sha3_generic.c:224 jent_hash_time+0x2cb/0x520 crypto/jitterentropy-kcapi.c:138 jent_condition_data+0xa8/0xe0 crypto/jitterentropy.c:437 jent_measure_jitter+0xc5/0x150 crypto/jitterentropy.c:540 jent_gen_entropy+0x89/0xe0 crypto/jitterentropy.c:568 jent_read_entropy+0xa3/0x220 crypto/jitterentropy.c:614 jent_kcapi_random+0x56/0x100 crypto/jitterentropy-kcapi.c:283 crypto_rng_generate include/crypto/rng.h:146 [inline] crypto_rng_get_bytes include/crypto/rng.h:163 [inline] drbg_seed+0x303/0xa60 crypto/drbg.c:1184 drbg_instantiate crypto/drbg.c:1596 [inline] drbg_kcapi_seed+0x454/0xfb0 crypto/drbg.c:1969 crypto_rng_reset crypto/rng.c:47 [inline] crypto_get_default_rng+0x159/0x200 crypto/rng.c:121 aead_init_geniv+0x63/0x260 crypto/geniv.c:118 crypto_create_tfm_node+0x167/0x3d0 crypto/api.c:522 crypto_alloc_tfm_node+0x161/0x360 crypto/api.c:623 esp_init_aead net/ipv6/esp6.c:1060 [inline] esp6_init_state+0x387/0x10b0 net/ipv6/esp6.c:1187 __xfrm_init_state+0x9dd/0xd70 net/xfrm/xfrm_state.c:2856 xfrm_state_construct net/xfrm/xfrm_user.c:836 [inline] xfrm_add_sa+0x29e7/0x3b20 net/xfrm/xfrm_user.c:894 xfrm_user_rcv_msg+0x75d/0xa80 net/xfrm/xfrm_user.c:3304 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2564 xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3326 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x8db/0xcb0 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2585 ___sys_sendmsg net/socket.c:2639 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2668 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f78f3a7cee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007f78f47b30c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f78f3babf80 RCX: 00007f78f3a7cee9 RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000006 RBP: 00007f78f3ac949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f78f3babf80 R15: 00007f78f3ccfa98 Allocated by task 6358: 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_noprof+0x19c/0x2c0 mm/slub.c:4152 kmalloc_noprof include/linux/slab.h:660 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] xpad_probe+0x3c8/0x1b90 drivers/input/joystick/xpad.c:2025 usb_probe_interface+0x645/0xbb0 drivers/usb/core/driver.c:399 really_probe+0x2b8/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+0x24e/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+0x856/0xbf0 drivers/base/core.c:3721 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+0x1b8/0x380 drivers/usb/core/driver.c:294 really_probe+0x2b8/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+0x24e/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+0x856/0xbf0 drivers/base/core.c:3721 usb_new_device+0x104a/0x19a0 drivers/usb/core/hub.c:2651 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:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 5182: 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+0xe0/0x150 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:2195 [inline] slab_free mm/slub.c:4436 [inline] kfree+0x149/0x360 mm/slub.c:4557 xpad_disconnect+0x359/0x490 drivers/input/joystick/xpad.c:2206 usb_unbind_interface+0x25e/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+0x503/0x7c0 drivers/base/dd.c:1293 bus_remove_device+0x34f/0x420 drivers/base/bus.c:574 device_del+0x57a/0x9b0 drivers/base/core.c:3910 usb_disable_device+0x3bf/0x850 drivers/usb/core/message.c:1418 usb_disconnect+0x340/0x950 drivers/usb/core/hub.c:2304 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:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/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 ffff88802e65e000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 92 bytes inside of freed 1024-byte region [ffff88802e65e000, ffff88802e65e400) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2e658 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000040 ffff888015041dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000 head: 00fff00000000040 ffff888015041dc0 0000000000000000 dead000000000001 head: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000 head: 00fff00000000003 ffffea0000b99601 ffffffffffffffff 0000000000000000 head: 0000000000000008 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5116, tgid 5116 (syz-executor.4), ts 64783095273, free_ts 64702614037 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x2e2d/0x2ee0 mm/page_alloc.c:3402 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4660 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2264 allocate_slab+0x5a/0x2e0 mm/slub.c:2427 new_slab mm/slub.c:2480 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3666 __slab_alloc+0x58/0xa0 mm/slub.c:3756 __slab_alloc_node mm/slub.c:3809 [inline] slab_alloc_node mm/slub.c:3988 [inline] __do_kmalloc_node mm/slub.c:4120 [inline] kmalloc_node_track_caller_noprof+0x281/0x440 mm/slub.c:4141 kmalloc_reserve+0x111/0x2a0 net/core/skbuff.c:597 __alloc_skb+0x1f3/0x440 net/core/skbuff.c:666 alloc_skb include/linux/skbuff.h:1308 [inline] nlmsg_new include/net/netlink.h:1015 [inline] inet6_rt_notify+0xdf/0x290 net/ipv6/route.c:6178 fib6_add_rt2node net/ipv6/ip6_fib.c:1262 [inline] fib6_add+0x1e33/0x4430 net/ipv6/ip6_fib.c:1491 __ip6_ins_rt net/ipv6/route.c:1313 [inline] ip6_route_add+0x8b/0x160 net/ipv6/route.c:3855 addrconf_prefix_route net/ipv6/addrconf.c:2485 [inline] fixup_permanent_addr net/ipv6/addrconf.c:3600 [inline] addrconf_permanent_addr+0x7c4/0xc50 net/ipv6/addrconf.c:3624 addrconf_notify+0x9f5/0x1020 net/ipv6/addrconf.c:3696 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93 page last free pid 5117 tgid 5117 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2565 __slab_free+0x31b/0x3d0 mm/slub.c:4347 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3940 [inline] slab_alloc_node mm/slub.c:4000 [inline] kmem_cache_alloc_lru_noprof+0x139/0x2b0 mm/slub.c:4019 sock_alloc_inode+0x28/0xc0 net/socket.c:308 alloc_inode fs/inode.c:261 [inline] new_inode_pseudo+0x69/0x1e0 fs/inode.c:1007 sock_alloc net/socket.c:634 [inline] __sock_create+0x123/0x920 net/socket.c:1535 sock_create net/socket.c:1622 [inline] __sys_socket_create net/socket.c:1659 [inline] __sys_socket+0x150/0x3c0 net/socket.c:1706 __do_sys_socket net/socket.c:1720 [inline] __se_sys_socket net/socket.c:1718 [inline] __x64_sys_socket+0x7a/0x90 net/socket.c:1718 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88802e65df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802e65df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802e65e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802e65e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802e65e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 00 d5 add %dl,%ch 2: 03 00 add (%rax),%eax 4: 65 8b 15 10 c0 6d 7e mov %gs:0x7e6dc010(%rip),%edx # 0x7e6dc01b b: f7 c2 00 01 ff 00 test $0xff0100,%edx 11: 74 11 je 0x24 13: f7 c2 00 01 00 00 test $0x100,%edx 19: 74 35 je 0x50 1b: 83 b9 1c 16 00 00 00 cmpl $0x0,0x161c(%rcx) 22: 74 2c je 0x50 24: 8b 91 f8 15 00 00 mov 0x15f8(%rcx),%edx * 2a: 83 fa 02 cmp $0x2,%edx <-- trapping instruction 2d: 75 21 jne 0x50 2f: 48 8b 91 00 16 00 00 mov 0x1600(%rcx),%rdx 36: 48 8b 32 mov (%rdx),%rsi 39: 48 8d 7e 01 lea 0x1(%rsi),%rdi 3d: 8b .byte 0x8b 3e: 89 fc mov %edi,%esp