EXT4-fs error (device loop2): ext4_orphan_get:1402: comm syz.2.139: couldn't read orphan inode 15 (err -117) EXT4-fs (loop2): mounted filesystem without journal. Opts: noauto_da_alloc,dioread_nolock,nolazytime,,errors=continue. Quota mode: none. ================================================================== BUG: KASAN: use-after-free in ext4_insert_dentry+0x392/0x710 fs/ext4/namei.c:2153 Write of size 251 at addr ffff88812e401f14 by task syz.2.139/1060 CPU: 1 PID: 1060 Comm: syz.2.139 Not tainted 5.15.167-syzkaller-android13-5.15.167_r00 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189 memcpy+0x44/0x70 mm/kasan/shadow.c:66 ext4_insert_dentry+0x392/0x710 fs/ext4/namei.c:2153 add_dirent_to_buf+0x384/0x7d0 fs/ext4/namei.c:2198 make_indexed_dir+0xf34/0x15a0 fs/ext4/namei.c:2396 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2502 ext4_add_nondir+0x97/0x290 fs/ext4/namei.c:2843 ext4_symlink+0x913/0xed0 fs/ext4/namei.c:3496 vfs_symlink+0x29f/0x480 fs/namei.c:4429 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4458 __do_sys_symlink fs/namei.c:4480 [inline] __se_sys_symlink fs/namei.c:4478 [inline] __x64_sys_symlink+0x7e/0x90 fs/namei.c:4478 x64_sys_call+0x290/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:89 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fc506922719 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:00007fc50559b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000058 RAX: ffffffffffffffda RBX: 00007fc506ad9f80 RCX: 00007fc506922719 RDX: 0000000000000000 RSI: 0000000020000cc0 RDI: 0000000020000dc0 RBP: 00007fc50699532e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fc506ad9f80 R15: 00007ffd35544228 The buggy address belongs to the page: page:ffffea0004b90040 refcount:3 mapcount:0 mapping:ffff888100485358 index:0x3f pfn:0x12e401 memcg:ffff88810f9cc000 aops:def_blk_aops ino:700002 flags: 0x400000000000202a(referenced|dirty|active|private|zone=1) raw: 400000000000202a 0000000000000000 dead000000000122 ffff888100485358 raw: 000000000000003f ffff888131785e70 00000003ffffffff ffff88810f9cc000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 1060, ts 90470101570, free_ts 90468683784 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] __page_cache_alloc include/linux/pagemap.h:305 [inline] pagecache_get_page+0xb18/0xeb0 mm/filemap.c:1946 find_or_create_page include/linux/pagemap.h:418 [inline] grow_dev_page fs/buffer.c:949 [inline] grow_buffers fs/buffer.c:1014 [inline] __getblk_slow fs/buffer.c:1041 [inline] __getblk_gfp+0x21e/0x7c0 fs/buffer.c:1336 sb_getblk include/linux/buffer_head.h:361 [inline] ext4_getblk+0x259/0x700 fs/ext4/inode.c:877 ext4_bread+0x2f/0x180 fs/ext4/inode.c:923 ext4_append+0x31f/0x5b0 fs/ext4/namei.c:83 make_indexed_dir+0x515/0x15a0 fs/ext4/namei.c:2316 ext4_add_entry+0xde2/0x12b0 fs/ext4/namei.c:2502 ext4_add_nondir+0x97/0x290 fs/ext4/namei.c:2843 ext4_symlink+0x913/0xed0 fs/ext4/namei.c:3496 vfs_symlink+0x29f/0x480 fs/namei.c:4429 do_symlinkat+0x1ea/0x5a0 fs/namei.c:4458 __do_sys_symlink fs/namei.c:4480 [inline] __se_sys_symlink fs/namei.c:4478 [inline] __x64_sys_symlink+0x7e/0x90 fs/namei.c:4478 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3671 release_pages+0x1310/0x1370 mm/swap.c:1009 __pagevec_release+0x84/0x100 mm/swap.c:1029 pagevec_release include/linux/pagevec.h:81 [inline] shmem_undo_range+0x604/0x1560 mm/shmem.c:965 shmem_truncate_range mm/shmem.c:1064 [inline] shmem_evict_inode+0x215/0x9d0 mm/shmem.c:1146 evict+0x529/0x930 fs/inode.c:622 iput_final fs/inode.c:1740 [inline] iput+0x63b/0x7e0 fs/inode.c:1766 dentry_unlink_inode+0x34e/0x430 fs/dcache.c:380 __dentry_kill+0x447/0x660 fs/dcache.c:586 dentry_kill+0xc0/0x2a0 dput+0x45/0x80 fs/dcache.c:893 do_renameat2+0xc5b/0x1480 fs/namei.c:4987 __do_sys_rename fs/namei.c:5031 [inline] __se_sys_rename fs/namei.c:5029 [inline] __x64_sys_rename+0x86/0x90 fs/namei.c:5029 x64_sys_call+0x266/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:83 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff88812e401f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88812e401f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88812e402000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88812e402080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88812e402100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop2): dx_make_map:1328: inode #12: block 255: comm syz.2.139: bad entry in directory: rec_len is too small for name_len - offset=780, inode=22, rec_len=244, size=1024 fake=0 EXT4-fs error (device loop2) in do_split:2093: Corrupt filesystem