================================================================== BUG: KASAN: use-after-free in __d_alloc+0x1a2/0x700 fs/dcache.c:1775 Read of size 5 at addr ffff88807d28d520 by task kdevtmpfs/22 CPU: 1 PID: 22 Comm: kdevtmpfs Not tainted 5.14.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106 print_address_description+0x66/0x3e0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x19a/0x1f0 mm/kasan/report.c:459 kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:189 memcpy+0x25/0x60 mm/kasan/shadow.c:65 __d_alloc+0x1a2/0x700 fs/dcache.c:1775 d_alloc+0x48/0x1d0 fs/dcache.c:1823 __lookup_hash+0xc8/0x240 fs/namei.c:1554 kern_path_locked+0x2f2/0x490 fs/namei.c:2567 handle_remove drivers/base/devtmpfs.c:312 [inline] handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop+0x264/0x1080 drivers/base/devtmpfs.c:395 devtmpfsd+0x44/0x50 drivers/base/devtmpfs.c:437 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 Allocated by task 22: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3214 [inline] kmem_cache_alloc+0x1c3/0x300 mm/slub.c:3219 getname_kernel+0x55/0x2d0 fs/namei.c:226 kern_path_locked+0xbb/0x490 fs/namei.c:2558 handle_remove drivers/base/devtmpfs.c:312 [inline] handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop+0x264/0x1080 drivers/base/devtmpfs.c:395 devtmpfsd+0x44/0x50 drivers/base/devtmpfs.c:437 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 Freed by task 22: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x10d/0x150 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1700 [inline] slab_free_freelist_hook+0x129/0x1a0 mm/slub.c:1725 slab_free mm/slub.c:3483 [inline] kmem_cache_free+0x85/0x180 mm/slub.c:3499 putname fs/namei.c:270 [inline] filename_parentat fs/namei.c:2547 [inline] kern_path_locked+0x226/0x490 fs/namei.c:2558 handle_remove drivers/base/devtmpfs.c:312 [inline] handle drivers/base/devtmpfs.c:382 [inline] devtmpfs_work_loop+0x264/0x1080 drivers/base/devtmpfs.c:395 devtmpfsd+0x44/0x50 drivers/base/devtmpfs.c:437 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 The buggy address belongs to the object at ffff88807d28d500 which belongs to the cache names_cache of size 4096 The buggy address is located 32 bytes inside of 4096-byte region [ffff88807d28d500, ffff88807d28e500) The buggy address belongs to the page: page:ffffea0001f4a200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d288 head:ffffea0001f4a200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888140007500 raw: 0000000000000000 0000000080070007 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 1843618427120, free_ts 1843361327213 prep_new_page mm/page_alloc.c:2424 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4153 __alloc_pages+0x255/0x580 mm/page_alloc.c:5375 alloc_slab_page mm/slub.c:1763 [inline] allocate_slab+0xcc/0x4d0 mm/slub.c:1900 new_slab mm/slub.c:1963 [inline] ___slab_alloc+0x41e/0xc40 mm/slub.c:2994 __slab_alloc mm/slub.c:3081 [inline] slab_alloc_node mm/slub.c:3172 [inline] slab_alloc mm/slub.c:3214 [inline] kmem_cache_alloc+0x274/0x300 mm/slub.c:3219 getname_flags+0xba/0x650 fs/namei.c:138 do_sys_openat2+0xd2/0x500 fs/open.c:1194 do_sys_open fs/open.c:1216 [inline] __do_sys_open fs/open.c:1224 [inline] __se_sys_open fs/open.c:1220 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1220 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0xc29/0xd20 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3315 [inline] free_unref_page+0x7d/0x580 mm/page_alloc.c:3394 free_slab mm/slub.c:2003 [inline] discard_slab mm/slub.c:2009 [inline] __unfreeze_partials+0x1ab/0x200 mm/slub.c:2495 put_cpu_partial+0x132/0x1a0 mm/slub.c:2575 do_slab_free mm/slub.c:3471 [inline] ___cache_free+0xe6/0x120 mm/slub.c:3490 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x151/0x1c0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3214 [inline] kmem_cache_alloc+0x1c3/0x300 mm/slub.c:3219 kmem_cache_zalloc include/linux/slab.h:711 [inline] __kernfs_new_node+0xdb/0x720 fs/kernfs/dir.c:585 kernfs_new_node+0x95/0x160 fs/kernfs/dir.c:647 __kernfs_create_file+0x45/0x2e0 fs/kernfs/file.c:985 sysfs_add_file_mode_ns+0x2fe/0x3d0 fs/sysfs/file.c:317 create_files fs/sysfs/group.c:64 [inline] internal_create_group+0x560/0xf10 fs/sysfs/group.c:149 loop_sysfs_init drivers/block/loop.c:912 [inline] loop_configure+0xe05/0x1500 drivers/block/loop.c:1294 lo_ioctl+0x8cd/0x2370 blkdev_ioctl+0x33b/0x6c0 block/ioctl.c:589 Memory state around the buggy address: ffff88807d28d400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807d28d480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807d28d500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807d28d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d28d600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================