================================================================== BUG: KASAN: slab-use-after-free in ext4_insert_dentry+0x3cd/0x780 fs/ext4/namei.c:2119 Write of size 248 at addr ffff8880571fbf20 by task syz.3.231/7856 CPU: 1 UID: 0 PID: 7856 Comm: syz.3.231 Not tainted 6.14.0-rc6-syzkaller-00022-gb7f94fcf5546 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106 ext4_insert_dentry+0x3cd/0x780 fs/ext4/namei.c:2119 add_dirent_to_buf+0x315/0x660 fs/ext4/namei.c:2164 make_indexed_dir+0xcaf/0x1280 fs/ext4/namei.c:2361 ext4_add_entry+0xb36/0xd30 fs/ext4/namei.c:2462 ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2803 ext4_create+0x377/0x550 fs/ext4/namei.c:2849 lookup_open fs/namei.c:3651 [inline] open_last_lookups fs/namei.c:3750 [inline] path_openat+0x193c/0x3590 fs/namei.c:3986 do_filp_open+0x27f/0x4e0 fs/namei.c:4016 do_sys_openat2+0x13e/0x1d0 fs/open.c:1428 do_sys_open fs/open.c:1443 [inline] __do_sys_creat fs/open.c:1521 [inline] __se_sys_creat fs/open.c:1515 [inline] __x64_sys_creat+0x123/0x170 fs/open.c:1515 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6b7558d169 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6b763d5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007f6b757a5fa0 RCX: 00007f6b7558d169 RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000400000000e00 RBP: 00007f6b7560e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f6b757a5fa0 R15: 00007ffeb23e1158 The buggy address belongs to the physical page: page: refcount:3 mapcount:0 mapping:ffff888148de8878 index:0x3f pfn:0x571fb memcg:ffff88807daf2000 aops:def_blk_aops ino:700003 dentry name(?):"" flags: 0xfff00000004114(referenced|dirty|active|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000004114 0000000000000000 dead000000000122 ffff888148de8878 raw: 000000000000003f ffff88805af0e910 00000003ffffffff ffff88807daf2000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x148c40(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL), pid 7856, tgid 7855 (syz.3.231), ts 285225012941, free_ts 285154677589 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4740 alloc_pages_mpol+0x311/0x660 mm/mempolicy.c:2270 alloc_frozen_pages_noprof mm/mempolicy.c:2341 [inline] alloc_pages_noprof+0x121/0x190 mm/mempolicy.c:2361 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2371 filemap_alloc_folio_noprof+0xe1/0x540 mm/filemap.c:1019 __filemap_get_folio+0x438/0xae0 mm/filemap.c:1970 grow_dev_folio fs/buffer.c:1039 [inline] grow_buffers fs/buffer.c:1105 [inline] __getblk_slow fs/buffer.c:1131 [inline] bdev_getblk+0x1d4/0x670 fs/buffer.c:1431 getblk_unmovable include/linux/buffer_head.h:369 [inline] ext4_getblk+0x31b/0x880 fs/ext4/inode.c:864 ext4_bread+0x2e/0x180 fs/ext4/inode.c:912 ext4_append+0x327/0x5c0 fs/ext4/namei.c:83 make_indexed_dir+0x3ff/0x1280 fs/ext4/namei.c:2282 ext4_add_entry+0xb36/0xd30 fs/ext4/namei.c:2462 ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2803 ext4_create+0x377/0x550 fs/ext4/namei.c:2849 page last free pid 7847 tgid 7847 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0xe04/0x10e0 mm/page_alloc.c:2660 pagetable_free include/linux/mm.h:2917 [inline] pagetable_dtor_free include/linux/mm.h:3015 [inline] __tlb_remove_table+0x33c/0x420 include/asm-generic/tlb.h:216 __tlb_remove_table_free mm/mmu_gather.c:227 [inline] tlb_remove_table_rcu+0x76/0xf0 mm/mmu_gather.c:282 rcu_do_batch kernel/rcu/tree.c:2546 [inline] rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2802 handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:561 __do_softirq kernel/softirq.c:595 [inline] invoke_softirq kernel/softirq.c:435 [inline] __irq_exit_rcu+0xf7/0x220 kernel/softirq.c:662 irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0x57/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Memory state around the buggy address: ffff8880571fbf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880571fbf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880571fc000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880571fc080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa ffff8880571fc100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================