================================================================== BUG: KASAN: slab-use-after-free in kernfs_root fs/kernfs/kernfs-internal.h:68 [inline] BUG: KASAN: slab-use-after-free in kernfs_add_one+0x44a/0x8b0 fs/kernfs/dir.c:809 Read of size 8 at addr ffff888029328ce0 by task kworker/0:19/15080 CPU: 0 PID: 15080 Comm: kworker/0:19 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: events request_firmware_work_func 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 kernfs_root fs/kernfs/kernfs-internal.h:68 [inline] kernfs_add_one+0x44a/0x8b0 fs/kernfs/dir.c:809 kernfs_create_dir_ns+0xd9/0x120 fs/kernfs/dir.c:1062 sysfs_create_dir_ns+0x189/0x3a0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x435/0x8d0 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_add+0x152/0x220 lib/kobject.c:426 class_dir_create_and_add drivers/base/core.c:3182 [inline] get_device_parent+0x391/0x410 drivers/base/core.c:3233 device_add+0x331/0xca0 drivers/base/core.c:3563 fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:86 [inline] fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:162 [inline] firmware_fallback_sysfs+0x307/0x9e0 drivers/base/firmware_loader/fallback.c:238 _request_firmware+0xc97/0x1250 drivers/base/firmware_loader/main.c:910 request_firmware_work_func+0x12a/0x280 drivers/base/firmware_loader/main.c:1161 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Allocated by task 15080: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x174/0x340 mm/slub.c:3852 kmem_cache_zalloc include/linux/slab.h:739 [inline] __kernfs_new_node+0xd8/0x880 fs/kernfs/dir.c:615 kernfs_new_node+0x13a/0x240 fs/kernfs/dir.c:691 kernfs_create_dir_ns+0x43/0x120 fs/kernfs/dir.c:1052 sysfs_create_dir_ns+0x189/0x3a0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x435/0x8d0 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_add+0x152/0x220 lib/kobject.c:426 class_dir_create_and_add drivers/base/core.c:3182 [inline] get_device_parent+0x391/0x410 drivers/base/core.c:3233 device_add+0x331/0xca0 drivers/base/core.c:3563 fw_load_sysfs_fallback drivers/base/firmware_loader/fallback.c:86 [inline] fw_load_from_user_helper drivers/base/firmware_loader/fallback.c:162 [inline] firmware_fallback_sysfs+0x307/0x9e0 drivers/base/firmware_loader/fallback.c:238 _request_firmware+0xc97/0x1250 drivers/base/firmware_loader/main.c:910 request_firmware_work_func+0x12a/0x280 drivers/base/firmware_loader/main.c:1161 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Freed by task 5134: 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+0xa6/0xe0 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:2106 [inline] slab_free mm/slub.c:4280 [inline] kmem_cache_free+0x102/0x2b0 mm/slub.c:4344 kernfs_put+0x2a4/0x420 fs/kernfs/dir.c:569 __kernfs_remove+0x76e/0x880 fs/kernfs/dir.c:1499 kernfs_remove+0x7a/0xa0 fs/kernfs/dir.c:1519 __kobject_del+0xe2/0x310 lib/kobject.c:604 kobject_del+0x45/0x60 lib/kobject.c:627 device_del+0x83e/0xa30 drivers/base/core.c:3848 usb_disconnect+0x60b/0x950 drivers/usb/core/hub.c:2295 hub_port_connect drivers/usb/core/hub.c:5323 [inline] hub_port_connect_change drivers/usb/core/hub.c:5623 [inline] port_event drivers/usb/core/hub.c:5783 [inline] hub_event+0x1e62/0x50f0 drivers/usb/core/hub.c:5865 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 The buggy address belongs to the object at ffff888029328cb0 which belongs to the cache kernfs_node_cache of size 168 The buggy address is located 48 bytes inside of freed 168-byte region [ffff888029328cb0, ffff888029328d58) The buggy address belongs to the physical page: page:ffffea0000a4ca00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29328 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff888015aeddc0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080110011 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 5134, tgid 5134 (kworker/0:6), ts 425346538872, free_ts 425339417619 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x256/0x680 mm/page_alloc.c:4569 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] kmem_cache_alloc+0x252/0x340 mm/slub.c:3852 kmem_cache_zalloc include/linux/slab.h:739 [inline] __kernfs_new_node+0xd8/0x880 fs/kernfs/dir.c:615 kernfs_new_node+0x13a/0x240 fs/kernfs/dir.c:691 __kernfs_create_file+0x49/0x2f0 fs/kernfs/file.c:1025 sysfs_add_file_mode_ns+0x24a/0x310 fs/sysfs/file.c:307 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x4f4/0xf20 fs/sysfs/group.c:152 internal_create_groups fs/sysfs/group.c:192 [inline] sysfs_create_groups+0x56/0x120 fs/sysfs/group.c:218 device_add_groups drivers/base/core.c:2741 [inline] device_add_attrs+0x199/0x600 drivers/base/core.c:2861 device_add+0x57d/0xca0 drivers/base/core.c:3593 usb_create_ep_devs+0x130/0x230 drivers/usb/core/endpoint.c:169 page last free pid 7489 tgid 7489 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486 vfree+0x186/0x2e0 mm/vmalloc.c:2914 delayed_vfree_work+0x56/0x80 mm/vmalloc.c:2835 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Memory state around the buggy address: ffff888029328b80: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb ffff888029328c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc >ffff888029328c80: fc fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb ^ ffff888029328d00: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc ffff888029328d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================