BUG: KASAN: use-after-free in ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246 Read of size 1 at addr ffff888106bc2a67 by task syz-executor263/306 CPU: 0 PID: 306 Comm: syz-executor263 Not tainted 5.15.173-syzkaller-00161-gb4bd207b0380 #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 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306 ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246 ext4_dx_readdir fs/ext4/dir.c:606 [inline] ext4_readdir+0x2f75/0x3960 fs/ext4/dir.c:142 iterate_dir+0x265/0x600 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354 x64_sys_call+0x5ae/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:218 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:0x7f38484ab1a3 Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 c2 2b fb ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8 RSP: 002b:00007ffc967c2478 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 000055557e368730 RCX: 00007f38484ab1a3 RDX: 0000000000008000 RSI: 000055557e368730 RDI: 0000000000000004 RBP: 000055557e368704 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb8 R13: 0000000000000010 R14: 000055557e368700 R15: 431bde82d7b634db The buggy address belongs to the page: page:ffffea00041af080 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106bc2 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 0000000000000000 dead000000000000 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed 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 1258571303, free_ts 14556922226 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 allocate_slab mm/slub.c:1932 [inline] new_slab+0x9a/0x4e0 mm/slub.c:1995 ___slab_alloc+0x39e/0x830 mm/slub.c:3028 __slab_alloc+0x4a/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3250 [inline] kmem_cache_alloc_trace+0x147/0x270 mm/slub.c:3267 kmalloc include/linux/slab.h:603 [inline] kzalloc include/linux/slab.h:733 [inline] kobject_uevent_env+0x269/0x700 lib/kobject_uevent.c:539 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:657 kernel_add_sysfs_param+0x108/0x130 kernel/params.c:816 param_sysfs_builtin+0x16a/0x1f0 kernel/params.c:851 param_sysfs_init+0x6a/0x70 kernel/params.c:970 do_one_initcall+0x182/0x610 init/main.c:1302 do_initcall_level+0x186/0x310 init/main.c:1375 do_initcalls+0x4e/0x90 init/main.c:1391 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+0xe8/0x750 mm/page_alloc.c:3616 free_the_page mm/page_alloc.c:805 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5855 __free_slab+0xec/0x1d0 mm/slub.c:2020 free_slab mm/slub.c:2035 [inline] discard_slab mm/slub.c:2041 [inline] __unfreeze_partials+0x165/0x1a0 mm/slub.c:2527 put_cpu_partial+0xc4/0x120 mm/slub.c:2607 __slab_free+0x1c8/0x290 mm/slub.c:3390 do_slab_free mm/slub.c:3509 [inline] ___cache_free+0x109/0x120 mm/slub.c:3530 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157 qlist_free_all+0x44/0xb0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:443 kasan_slab_alloc include/linux/kasan.h:217 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550 slab_alloc_node mm/slub.c:3240 [inline] slab_alloc mm/slub.c:3250 [inline] kmem_cache_alloc+0xf5/0x250 mm/slub.c:3255 sock_alloc_inode+0x1b/0xb0 net/socket.c:303 alloc_inode fs/inode.c:236 [inline] new_inode_pseudo+0x64/0x220 fs/inode.c:976 Memory state around the buggy address: ffff888106bc2900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888106bc2980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888106bc2a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888106bc2a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888106bc2b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================