================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:644 [inline] BUG: KASAN: slab-use-after-free in string+0x1dc/0x264 lib/vsprintf.c:726 Read of size 1 at addr ffff0000d7e33500 by task udevd/18096 CPU: 0 PID: 18096 Comm: udevd Not tainted 6.4.0-rc4-syzkaller-gcd6bd67ad7ab #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x174/0x514 mm/kasan/report.c:462 kasan_report+0xd4/0x130 mm/kasan/report.c:572 __asan_report_load1_noabort+0x20/0x2c mm/kasan/report_generic.c:378 string_nocheck lib/vsprintf.c:644 [inline] string+0x1dc/0x264 lib/vsprintf.c:726 vsnprintf+0xe9c/0x1a8c lib/vsprintf.c:2817 add_uevent_var+0x190/0x3c0 lib/kobject_uevent.c:665 dev_uevent+0x348/0x790 drivers/base/core.c:2575 uevent_show+0x1a4/0x320 drivers/base/core.c:2646 dev_attr_show+0x60/0xcc drivers/base/core.c:2349 sysfs_kf_seq_show+0x2d0/0x43c fs/sysfs/file.c:59 kernfs_seq_show+0x150/0x1fc fs/kernfs/file.c:205 seq_read_iter+0x3e0/0xc44 fs/seq_file.c:230 kernfs_fop_read_iter+0x144/0x5c8 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:1862 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x5bc/0x8ac fs/read_write.c:470 ksys_read+0x15c/0x26c 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+0x7c/0x90 fs/read_write.c:621 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193 el0_svc+0x4c/0x160 arch/arm64/kernel/entry-common.c:647 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Allocated by task 21875: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x7c mm/kasan/common.c:52 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:510 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] kmalloc_trace+0x70/0x88 mm/slab_common.c:1062 kmalloc include/linux/slab.h:559 [inline] raw_ioctl_init drivers/usb/gadget/legacy/raw_gadget.c:460 [inline] raw_ioctl+0x16e4/0x33ac drivers/usb/gadget/legacy/raw_gadget.c:1250 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+0x14c/0x1c8 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193 el0_svc+0x4c/0x160 arch/arm64/kernel/entry-common.c:647 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 Freed by task 21874: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x7c mm/kasan/common.c:52 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:521 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x2a8/0x49c mm/slub.c:3799 kfree+0xb8/0x19c mm/slab_common.c:1015 dev_free drivers/usb/gadget/legacy/raw_gadget.c:210 [inline] kref_put+0xb8/0x6d0 include/linux/kref.h:65 raw_release+0x12c/0x1bc drivers/usb/gadget/legacy/raw_gadget.c:424 __fput+0x30c/0x7bc fs/file_table.c:321 ____fput+0x20/0x30 fs/file_table.c:349 task_work_run+0x230/0x2e0 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x63c/0x1f58 kernel/exit.c:871 do_group_exit+0x194/0x22c kernel/exit.c:1021 get_signal+0x14b0/0x159c kernel/signal.c:2874 do_signal arch/arm64/kernel/signal.c:1249 [inline] do_notify_resume+0x3cc/0x3c90 arch/arm64/kernel/signal.c:1302 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] asm_exit_to_user_mode+0x68/0x7c arch/arm64/kernel/entry-common.c:151 ret_from_fork+0x1c/0x20 arch/arm64/kernel/entry.S:856 Last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:45 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:491 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:501 kvfree_call_rcu+0xa8/0x688 kernel/rcu/tree.c:3332 cfg80211_update_known_bss+0x13c/0x7e0 cfg80211_bss_update+0x160/0x1c64 net/wireless/scan.c:1732 cfg80211_inform_single_bss_frame_data net/wireless/scan.c:2482 [inline] cfg80211_inform_bss_frame_data+0x8b4/0x1fcc net/wireless/scan.c:2515 ieee80211_bss_info_update+0x69c/0xc84 net/mac80211/scan.c:190 ieee80211_rx_bss_info net/mac80211/ibss.c:1120 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline] ieee80211_ibss_rx_queued_mgmt+0x918/0x2974 net/mac80211/ibss.c:1638 ieee80211_iface_process_skb net/mac80211/iface.c:1594 [inline] ieee80211_iface_work+0x5d0/0xa9c net/mac80211/iface.c:1648 process_one_work+0x788/0x12d4 kernel/workqueue.c:2405 worker_thread+0x8e0/0xfe8 kernel/workqueue.c:2552 kthread+0x288/0x310 kernel/kthread.c:379 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:853 Second to last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:45 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:491 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:501 kvfree_call_rcu+0xa8/0x688 kernel/rcu/tree.c:3332 kernfs_unlink_open_file+0x398/0x448 fs/kernfs/file.c:633 kernfs_fop_release+0x130/0x198 fs/kernfs/file.c:805 __fput+0x30c/0x7bc fs/file_table.c:321 ____fput+0x20/0x30 fs/file_table.c:349 task_work_run+0x230/0x2e0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x2180/0x3c90 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+0x94/0x160 arch/arm64/kernel/entry-common.c:648 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591 The buggy address belongs to the object at ffff0000d7e33500 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 0 bytes inside of freed 128-byte region [ffff0000d7e33500, ffff0000d7e33580) The buggy address belongs to the physical page: page:000000002ea5eb7a refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117e33 flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 05ffc00000000200 ffff0000c0002300 fffffc0003393480 dead000000000004 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d7e33400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d7e33480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000d7e33500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000d7e33580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000d7e33600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================