================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:644 [inline] BUG: KASAN: slab-use-after-free in string+0x29c/0x2c4 lib/vsprintf.c:726 Read of size 1 at addr ffff0000145f7640 by task udevd/12053 CPU: 0 PID: 12053 Comm: udevd Not tainted 6.5.0-rc7-syzkaller-00004-gf7757129e3de #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x9c/0x11c arch/arm64/kernel/stacktrace.c:233 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x74/0xd4 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xd8/0x598 mm/kasan/report.c:475 kasan_report+0xc8/0x108 mm/kasan/report.c:588 __asan_report_load1_noabort+0x20/0x2c mm/kasan/report_generic.c:378 string_nocheck lib/vsprintf.c:644 [inline] string+0x29c/0x2c4 lib/vsprintf.c:726 vsnprintf+0x430/0xf74 lib/vsprintf.c:2817 add_uevent_var+0x130/0x318 lib/kobject_uevent.c:665 dev_uevent+0x158/0x5a4 drivers/base/core.c:2575 uevent_show+0x148/0x2e8 drivers/base/core.c:2646 dev_attr_show+0x48/0xcc drivers/base/core.c:2349 sysfs_kf_seq_show+0x184/0x32c fs/sysfs/file.c:59 kernfs_seq_show+0x104/0x154 fs/kernfs/file.c:205 seq_read_iter+0x350/0xe3c fs/seq_file.c:230 kernfs_fop_read_iter+0x300/0x458 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:1871 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x498/0x6e4 fs/read_write.c:470 ksys_read+0xf0/0x1dc fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __arm64_sys_read+0x6c/0x9c fs/read_write.c:621 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x6c/0x258 arch/arm64/kernel/syscall.c:52 el0_svc_common.constprop.0+0xc4/0x244 arch/arm64/kernel/syscall.c:139 do_el0_svc+0x50/0x11c arch/arm64/kernel/syscall.c:188 el0_svc+0x4c/0x134 arch/arm64/kernel/entry-common.c:647 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Allocated by task 12055: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:45 kasan_set_track+0x2c/0x40 mm/kasan/common.c:52 kasan_save_alloc_info+0x24/0x34 mm/kasan/generic.c:511 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xb8/0xbc mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] kmalloc_trace+0x74/0x88 mm/slab_common.c:1081 kmalloc include/linux/slab.h:582 [inline] raw_ioctl_init+0x1e8/0x69c drivers/usb/gadget/legacy/raw_gadget.c:462 raw_ioctl+0xabc/0x2604 drivers/usb/gadget/legacy/raw_gadget.c:1252 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __arm64_sys_ioctl+0x124/0x190 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x6c/0x258 arch/arm64/kernel/syscall.c:52 el0_svc_common.constprop.0+0xc4/0x244 arch/arm64/kernel/syscall.c:139 do_el0_svc+0x50/0x11c arch/arm64/kernel/syscall.c:188 el0_svc+0x4c/0x134 arch/arm64/kernel/entry-common.c:647 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Freed by task 12054: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:45 kasan_set_track+0x2c/0x40 mm/kasan/common.c:52 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x120/0x1b8 mm/kasan/common.c:200 __kasan_slab_free+0x18/0x24 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook mm/slub.c:1818 [inline] slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xf4/0x34c mm/slub.c:3814 kfree+0xbc/0x1ac mm/slab_common.c:1034 dev_free+0x80/0x5c4 drivers/usb/gadget/legacy/raw_gadget.c:210 kref_put include/linux/kref.h:65 [inline] raw_release+0x138/0x27c drivers/usb/gadget/legacy/raw_gadget.c:426 __fput+0x2a8/0x86c fs/file_table.c:384 ____fput+0x10/0x1c fs/file_table.c:412 task_work_run+0x124/0x20c kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0xb6c/0x3028 arch/arm64/kernel/signal.c:1305 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:144 [inline] el0_svc+0x110/0x134 arch/arm64/kernel/entry-common.c:648 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Last potentially related work creation: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xe4 mm/kasan/generic.c:492 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:502 __call_rcu_common.constprop.0+0x9c/0x8c0 kernel/rcu/tree.c:2649 call_rcu+0x10/0x1c kernel/rcu/tree.c:2763 gro_cells_destroy net/core/gro_cells.c:128 [inline] gro_cells_destroy+0x24c/0x39c net/core/gro_cells.c:105 ip_tunnel_dev_free+0x1c/0x5c net/ipv4/ip_tunnel.c:1031 netdev_run_todo+0x4fc/0xc98 net/core/dev.c:10358 rtnl_unlock+0x10/0x1c net/core/rtnetlink.c:151 ip_tunnel_delete_nets+0x224/0x2ec net/ipv4/ip_tunnel.c:1145 erspan_exit_batch_net+0x20/0x2c net/ipv4/ip_gre.c:1717 ops_exit_list+0xf0/0x140 net/core/net_namespace.c:175 cleanup_net+0x3b0/0x838 net/core/net_namespace.c:614 process_one_work+0x80c/0x1570 kernel/workqueue.c:2600 worker_thread+0x3f8/0xf54 kernel/workqueue.c:2751 kthread+0x27c/0x300 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:853 The buggy address belongs to the object at ffff0000145f7640 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of freed 32-byte region [ffff0000145f7640, ffff0000145f7660) The buggy address belongs to the physical page: page:000000000d5c1179 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x545f7 flags: 0x1ffc00000000200(slab|node=0|zone=0|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 01ffc00000000200 ffff000009801500 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000400040 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000145f7500: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ffff0000145f7580: fa fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc >ffff0000145f7600: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff0000145f7680: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ffff0000145f7700: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================