================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:646 [inline] BUG: KASAN: slab-use-after-free in string+0x29c/0x2c4 lib/vsprintf.c:728 Read of size 1 at addr ffff000017a969c0 by task udevd/28436 CPU: 1 PID: 28436 Comm: udevd Not tainted 6.9.0-rc1-syzkaller-00178-g317c7bc0ef03 #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x9c/0x11c arch/arm64/kernel/stacktrace.c:317 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xa4/0xf4 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xd8/0x59c mm/kasan/report.c:488 kasan_report+0xc8/0x108 mm/kasan/report.c:601 __asan_report_load1_noabort+0x20/0x2c mm/kasan/report_generic.c:378 string_nocheck lib/vsprintf.c:646 [inline] string+0x29c/0x2c4 lib/vsprintf.c:728 vsnprintf+0x430/0xf74 lib/vsprintf.c:2824 add_uevent_var+0x130/0x318 lib/kobject_uevent.c:664 dev_uevent+0x158/0x5a0 drivers/base/core.c:2656 uevent_show+0x148/0x2ec drivers/base/core.c:2727 dev_attr_show+0x48/0xcc drivers/base/core.c:2430 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+0x304/0x45c fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2102 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x594/0x948 fs/read_write.c:476 ksys_read+0xf0/0x1dc fs/read_write.c:619 __do_sys_read fs/read_write.c:629 [inline] __se_sys_read fs/read_write.c:627 [inline] __arm64_sys_read+0x6c/0x9c fs/read_write.c:627 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x6c/0x258 arch/arm64/kernel/syscall.c:48 el0_svc_common.constprop.0+0xac/0x230 arch/arm64/kernel/syscall.c:133 do_el0_svc+0x40/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x50/0x180 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Allocated by task 28433: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 kasan_save_track+0x20/0x3c mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x54 mm/kasan/generic.c:565 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xb8/0xbc mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x17c/0x328 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] raw_ioctl_init+0x1e8/0x69c drivers/usb/gadget/legacy/raw_gadget.c:509 raw_ioctl+0xabc/0x2604 drivers/usb/gadget/legacy/raw_gadget.c:1303 __do_compat_sys_ioctl fs/ioctl.c:1004 [inline] __se_compat_sys_ioctl fs/ioctl.c:947 [inline] __arm64_compat_sys_ioctl+0x1d4/0x21c fs/ioctl.c:947 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x6c/0x258 arch/arm64/kernel/syscall.c:48 el0_svc_common.constprop.0+0xac/0x230 arch/arm64/kernel/syscall.c:133 do_el0_svc_compat+0x40/0x68 arch/arm64/kernel/syscall.c:158 el0_svc_compat+0x4c/0x17c arch/arm64/kernel/entry-common.c:852 el0t_32_sync_handler+0x98/0x13c arch/arm64/kernel/entry-common.c:862 el0t_32_sync+0x194/0x198 arch/arm64/kernel/entry.S:603 Freed by task 28431: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 kasan_save_track+0x20/0x3c mm/kasan/common.c:68 kasan_save_free_info+0x4c/0x74 mm/kasan/generic.c:579 poison_slab_object+0x11c/0x16c mm/kasan/common.c:240 __kasan_slab_free+0x1c/0x44 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x118/0x350 mm/slub.c:4390 dev_free+0x80/0x5c0 drivers/usb/gadget/legacy/raw_gadget.c:211 kref_put include/linux/kref.h:65 [inline] raw_release+0x138/0x27c drivers/usb/gadget/legacy/raw_gadget.c:473 __fput+0x1a4/0x92c fs/file_table.c:422 __fput_sync+0x74/0x84 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __arm64_sys_close+0x6c/0xbc fs/open.c:1541 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x6c/0x258 arch/arm64/kernel/syscall.c:48 el0_svc_common.constprop.0+0xac/0x230 arch/arm64/kernel/syscall.c:133 do_el0_svc_compat+0x40/0x68 arch/arm64/kernel/syscall.c:158 el0_svc_compat+0x4c/0x17c arch/arm64/kernel/entry-common.c:852 el0t_32_sync_handler+0x98/0x13c arch/arm64/kernel/entry-common.c:862 el0t_32_sync+0x194/0x198 arch/arm64/kernel/entry.S:603 The buggy address belongs to the object at ffff000017a969c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of freed 32-byte region [ffff000017a969c0, ffff000017a969e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x57a96 flags: 0x1ffe00000000800(slab|node=0|zone=0|lastcpupid=0xfff) page_type: 0xffffffff() raw: 01ffe00000000800 ffff000009c01500 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000400040 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff000017a96880: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff000017a96900: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff000017a96980: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff000017a96a00: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff000017a96a80: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================