================================================================== BUG: KASAN: use-after-free in string_nocheck lib/vsprintf.c:641 [inline] BUG: KASAN: use-after-free in string+0x21f/0x2b0 lib/vsprintf.c:723 Read of size 1 at addr ffff888118ab1178 by task syz.2.1704/7155 CPU: 0 PID: 7155 Comm: syz.2.1704 Not tainted 5.10.238-syzkaller-00282-gd76d4cd0623a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0xe2/0x130 mm/kasan/report.c:452 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306 string_nocheck lib/vsprintf.c:641 [inline] string+0x21f/0x2b0 lib/vsprintf.c:723 vsnprintf+0xf20/0x1960 lib/vsprintf.c:2689 seq_vprintf fs/seq_file.c:398 [inline] seq_printf+0x175/0x260 fs/seq_file.c:413 input_devices_seq_show+0x14b/0x650 drivers/input/input.c:1184 seq_read_iter+0x93f/0xd30 fs/seq_file.c:272 seq_read+0x3cc/0x4d0 fs/seq_file.c:162 pde_read fs/proc/inode.c:321 [inline] proc_reg_read+0x1c4/0x2b0 fs/proc/inode.c:333 vfs_read+0x1fe/0xa10 fs/read_write.c:494 ksys_read+0x140/0x240 fs/read_write.c:634 __do_sys_read fs/read_write.c:644 [inline] __se_sys_read fs/read_write.c:642 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:642 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f89985d0929 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8996c39038 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007f89987f7fa0 RCX: 00007f89985d0929 RDX: 0000000000002020 RSI: 0000200000004100 RDI: 0000000000000003 RBP: 00007f8998652b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f89987f7fa0 R15: 00007ffd70e50e68 Allocated by task 645: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:430 [inline] ____kasan_kmalloc mm/kasan/common.c:509 [inline] __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:518 kasan_kmalloc include/linux/kasan.h:254 [inline] kmem_cache_alloc_trace+0x184/0x2e0 mm/slub.c:2974 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] xpad_probe+0x3f9/0x1a30 drivers/input/joystick/xpad.c:1777 usb_probe_interface+0x5ff/0xae0 drivers/usb/core/driver.c:397 really_probe+0x3d8/0xa90 drivers/base/dd.c:562 driver_probe_device+0xe7/0x190 drivers/base/dd.c:752 __device_attach_driver+0x282/0x3f0 drivers/base/dd.c:863 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:433 __device_attach+0x29a/0x400 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xc0/0x1e0 drivers/base/bus.c:493 device_add+0x8b4/0xbf0 drivers/base/core.c:3273 usb_set_configuration+0x1a47/0x1f80 drivers/usb/core/message.c:2160 usb_generic_driver_probe+0x91/0x150 drivers/usb/core/generic.c:238 usb_probe_device+0x148/0x260 drivers/usb/core/driver.c:294 really_probe+0x3d8/0xa90 drivers/base/dd.c:562 driver_probe_device+0xe7/0x190 drivers/base/dd.c:752 __device_attach_driver+0x282/0x3f0 drivers/base/dd.c:863 bus_for_each_drv+0x175/0x200 drivers/base/bus.c:433 __device_attach+0x29a/0x400 drivers/base/dd.c:932 device_initial_probe+0x1a/0x20 drivers/base/dd.c:981 bus_probe_device+0xc0/0x1e0 drivers/base/bus.c:493 device_add+0x8b4/0xbf0 drivers/base/core.c:3273 usb_new_device+0xcd1/0x1450 drivers/usb/core/hub.c:2626 hub_port_connect drivers/usb/core/hub.c:5469 [inline] hub_port_connect_change drivers/usb/core/hub.c:5609 [inline] port_event drivers/usb/core/hub.c:5759 [inline] hub_event+0x2679/0x4120 drivers/usb/core/hub.c:5841 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447 kthread+0x346/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Freed by task 463: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kfree+0xc0/0x270 mm/slub.c:4191 xpad_disconnect+0x377/0x4a0 drivers/input/joystick/xpad.c:1925 usb_unbind_interface+0x212/0x8c0 drivers/usb/core/driver.c:459 __device_release_driver drivers/base/dd.c:-1 [inline] device_release_driver_internal+0x4bc/0x750 drivers/base/dd.c:1221 device_release_driver+0x19/0x20 drivers/base/dd.c:1244 bus_remove_device+0x2dd/0x340 drivers/base/bus.c:535 device_del+0x696/0xed0 drivers/base/core.c:3452 usb_disable_device+0x3a8/0x750 drivers/usb/core/message.c:1411 usb_disconnect+0x31e/0x850 drivers/usb/core/hub.c:2282 hub_port_connect drivers/usb/core/hub.c:5308 [inline] hub_port_connect_change drivers/usb/core/hub.c:5609 [inline] port_event drivers/usb/core/hub.c:5759 [inline] hub_event+0x1912/0x4120 drivers/usb/core/hub.c:5841 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447 kthread+0x346/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 insert_work+0x52/0x310 kernel/workqueue.c:1352 __queue_work+0x923/0xca0 kernel/workqueue.c:1518 queue_work_on+0xd5/0x130 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:515 [inline] schedule_work include/linux/workqueue.h:576 [inline] xpad360w_process_packet drivers/input/joystick/xpad.c:846 [inline] xpad_irq_in+0xd07/0x1a80 drivers/input/joystick/xpad.c:984 __usb_hcd_giveback_urb+0x333/0x4f0 drivers/usb/core/hcd.c:1674 usb_hcd_giveback_urb+0x119/0x410 drivers/usb/core/hcd.c:1748 dummy_timer+0x804/0x2c30 drivers/usb/gadget/udc/dummy_hcd.c:1974 call_timer_fn+0x38/0x290 kernel/time/timer.c:1450 expire_timers kernel/time/timer.c:1495 [inline] __run_timers+0x639/0x9a0 kernel/time/timer.c:1789 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1802 __do_softirq+0x255/0x563 kernel/softirq.c:309 Second to last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 insert_work+0x52/0x310 kernel/workqueue.c:1352 __queue_work+0x923/0xca0 kernel/workqueue.c:1518 queue_work_on+0xd5/0x130 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:515 [inline] schedule_work include/linux/workqueue.h:576 [inline] xpad360w_process_packet drivers/input/joystick/xpad.c:846 [inline] xpad_irq_in+0xd07/0x1a80 drivers/input/joystick/xpad.c:984 __usb_hcd_giveback_urb+0x333/0x4f0 drivers/usb/core/hcd.c:1674 usb_hcd_giveback_urb+0x119/0x410 drivers/usb/core/hcd.c:1748 dummy_timer+0x804/0x2c30 drivers/usb/gadget/udc/dummy_hcd.c:1974 call_timer_fn+0x38/0x290 kernel/time/timer.c:1450 expire_timers kernel/time/timer.c:1495 [inline] __run_timers+0x639/0x9a0 kernel/time/timer.c:1789 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1802 __do_softirq+0x255/0x563 kernel/softirq.c:309 The buggy address belongs to the object at ffff888118ab1000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 376 bytes inside of 512-byte region [ffff888118ab1000, ffff888118ab1200) The buggy address belongs to the page: page:ffffea000462ac00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118ab0 head:ffffea000462ac00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 ffffea00042aa400 0000000600000006 ffff888100043080 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5303, ts 232252771793, free_ts 232235202307 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x179/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5357 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1808 [inline] new_slab+0x84/0x3f0 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x2a6/0x450 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] __kmalloc_track_caller+0x1ef/0x320 mm/slub.c:4536 __kmalloc_reserve net/core/skbuff.c:144 [inline] __alloc_skb+0xdc/0x520 net/core/skbuff.c:212 alloc_skb include/linux/skbuff.h:1126 [inline] alloc_skb_with_frags+0xa2/0x560 net/core/skbuff.c:5993 sock_alloc_send_pskb+0x853/0x980 net/core/sock.c:2388 unix_dgram_sendmsg+0x5f4/0x17d0 net/unix/af_unix.c:1725 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] ____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2376 ___sys_sendmsg+0x1f0/0x260 net/socket.c:2430 __sys_sendmmsg+0x273/0x450 net/socket.c:2516 __do_sys_sendmmsg net/socket.c:2545 [inline] __se_sys_sendmmsg net/socket.c:2542 [inline] __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2542 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] __free_pages_ok+0x7fc/0x820 mm/page_alloc.c:1629 free_the_page mm/page_alloc.c:5418 [inline] __free_pages+0xdd/0x380 mm/page_alloc.c:5427 kfree+0x1e7/0x270 mm/slub.c:4188 kvfree+0x35/0x40 mm/util.c:647 bpf_check+0x8a7c/0xd720 kernel/bpf/verifier.c:12761 bpf_prog_load+0xf5a/0x1420 kernel/bpf/syscall.c:2234 __do_sys_bpf kernel/bpf/syscall.c:4435 [inline] __se_sys_bpf+0x442/0x680 kernel/bpf/syscall.c:4391 __x64_sys_bpf+0x7b/0x90 kernel/bpf/syscall.c:4391 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff888118ab1000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888118ab1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888118ab1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888118ab1180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888118ab1200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================