EXT4-fs (loop0): mounted filesystem without journal. Quota mode: none.
==================================================================
BUG: KASAN: use-after-free in ext4_insert_dentry+0x388/0x710 fs/ext4/namei.c:2155
Write of size 250 at addr ffff888126989f14 by task syz-executor156/293

CPU: 1 PID: 293 Comm: syz-executor156 Not tainted 6.1.134-syzkaller-00039-g3c6d0251e1fb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 __dump_stack+0x21/0x24 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x71/0x210 mm/kasan/report.c:316
 print_report+0x4a/0x60 mm/kasan/report.c:427
 kasan_report+0x122/0x150 mm/kasan/report.c:531
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x280/0x290 mm/kasan/generic.c:189
 memcpy+0x44/0x70 mm/kasan/shadow.c:66
 ext4_insert_dentry+0x388/0x710 fs/ext4/namei.c:2155
 add_dirent_to_buf+0x2ac/0x670 fs/ext4/namei.c:2200
 make_indexed_dir+0xe55/0x14a0 fs/ext4/namei.c:2398
 ext4_add_entry+0xb45/0xd70 fs/ext4/namei.c:2504
 ext4_mkdir+0x4da/0xc50 fs/ext4/namei.c:3081
 vfs_mkdir+0x39c/0x580 fs/namei.c:4105
 do_mkdirat+0x171/0x4c0 fs/namei.c:4130
 __do_sys_mkdirat fs/namei.c:4145 [inline]
 __se_sys_mkdirat fs/namei.c:4143 [inline]
 __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4143
 x64_sys_call+0x73d/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:259
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f985f57d549
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe6ee1c2d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f985f57d549
RDX: 0000000000000000 RSI: 00002000000005c0 RDI: 00000000ffffff9c
RBP: 0000000000000000 R08: 00007ffe6ee1c330 R09: 00007ffe6ee1c330
R10: 00007ffe6ee1c330 R11: 0000000000000246 R12: 00007ffe6ee1c330
R13: 00007ffe6ee1c410 R14: 431bde82d7b634db R15: 00007f985f5c601d
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00049a6240 refcount:3 mapcount:0 mapping:ffff88810b935fd0 index:0x3f pfn:0x126989
memcg:ffff888100332000
aops:def_blk_aops ino:700000
flags: 0x420000000000204a(referenced|dirty|workingset|private|zone=1)
raw: 420000000000204a 0000000000000000 dead000000000122 ffff88810b935fd0
raw: 000000000000003f ffff88810b925498 00000003ffffffff ffff888100332000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 293, tgid 293 (syz-executor156), ts 27892695701, free_ts 27796750917
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2637
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2644
 get_page_from_freelist+0x2c6e/0x2ce0 mm/page_alloc.c:4539
 __alloc_pages+0x19e/0x3a0 mm/page_alloc.c:5842
 __folio_alloc+0x12/0x40 mm/page_alloc.c:5874
 __folio_alloc_node include/linux/gfp.h:245 [inline]
 folio_alloc include/linux/gfp.h:274 [inline]
 filemap_alloc_folio include/linux/pagemap.h:513 [inline]
 __filemap_get_folio+0x6ec/0x980 mm/filemap.c:2018
 pagecache_get_page+0x2b/0x110 mm/folio-compat.c:110
 find_or_create_page include/linux/pagemap.h:654 [inline]
 grow_dev_page fs/buffer.c:989 [inline]
 grow_buffers fs/buffer.c:1054 [inline]
 __getblk_slow fs/buffer.c:1081 [inline]
 __getblk_gfp+0x217/0x7d0 fs/buffer.c:1376
 sb_getblk include/linux/buffer_head.h:356 [inline]
 ext4_getblk+0x26c/0x6d0 fs/ext4/inode.c:899
 ext4_bread+0x2b/0x170 fs/ext4/inode.c:945
 ext4_append+0x2c3/0x560 fs/ext4/namei.c:83
 make_indexed_dir+0x55d/0x14a0 fs/ext4/namei.c:2318
 ext4_add_entry+0xb45/0xd70 fs/ext4/namei.c:2504
 ext4_mkdir+0x4da/0xc50 fs/ext4/namei.c:3081
 vfs_mkdir+0x39c/0x580 fs/namei.c:4105
 do_mkdirat+0x171/0x4c0 fs/namei.c:4130
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1545 [inline]
 free_pcp_prepare mm/page_alloc.c:1619 [inline]
 free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3581
 free_unref_page_list+0xba/0x7c0 mm/page_alloc.c:3729
 release_pages+0xad1/0xb20 mm/swap.c:1043
 free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:315
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu mm/mmu_gather.c:261 [inline]
 tlb_finish_mmu+0x1aa/0x370 mm/mmu_gather.c:361
 unmap_region+0x28d/0x2e0 mm/mmap.c:2402
 do_mas_align_munmap+0xb94/0x11b0 mm/mmap.c:2668
 do_mas_munmap+0x241/0x2b0 mm/mmap.c:2726
 __vm_munmap+0x19f/0x2f0 mm/mmap.c:3025
 __do_sys_munmap mm/mmap.c:3051 [inline]
 __se_sys_munmap mm/mmap.c:3047 [inline]
 __x64_sys_munmap+0x6b/0x80 mm/mmap.c:3047
 x64_sys_call+0x8a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:12
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff888126989f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888126989f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88812698a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88812698a080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88812698a100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================