================================================================== BUG: KASAN: use-after-free in ocfs2_find_victim_chain fs/ocfs2/suballoc.c:1445 [inline] BUG: KASAN: use-after-free in ocfs2_claim_suballoc_bits+0x10d3/0x2560 fs/ocfs2/suballoc.c:1982 Read of size 4 at addr ffff88805b704000 by task syz.2.281/8469 CPU: 0 UID: 0 PID: 8469 Comm: syz.2.281 Not tainted 6.13.0-syzkaller-07259-g0f8e26b38d7a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 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:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 ocfs2_find_victim_chain fs/ocfs2/suballoc.c:1445 [inline] ocfs2_claim_suballoc_bits+0x10d3/0x2560 fs/ocfs2/suballoc.c:1982 ocfs2_claim_metadata+0x16d/0x580 fs/ocfs2/suballoc.c:2057 ocfs2_dx_dir_attach_index+0x231/0xf90 fs/ocfs2/dir.c:2325 ocfs2_expand_inline_dir fs/ocfs2/dir.c:3017 [inline] ocfs2_extend_dir+0x439f/0x53c0 fs/ocfs2/dir.c:3199 ocfs2_prepare_dir_for_insert+0x33b5/0x5c40 fs/ocfs2/dir.c:4304 ocfs2_symlink+0xd72/0x2d80 fs/ocfs2/namei.c:1873 vfs_symlink+0x137/0x2e0 fs/namei.c:4669 do_symlinkat+0x222/0x3a0 fs/namei.c:4695 __do_sys_symlink fs/namei.c:4716 [inline] __se_sys_symlink fs/namei.c:4714 [inline] __x64_sys_symlink+0x7a/0x90 fs/namei.c:4714 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:0x7fd59538cd29 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:00007fd59629c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000058 RAX: ffffffffffffffda RBX: 00007fd5955a5fa0 RCX: 00007fd59538cd29 RDX: 0000000000000000 RSI: 0000000020000cc0 RDI: 000000002000a900 RBP: 00007fd59540e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fd5955a5fa0 R15: 00007ffcf32b3a68 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:ffff888033f87930 index:0x3f7 pfn:0x5b704 memcg:ffff888011d2a000 aops:shmem_aops ino:5fe dentry name(?):"memfd:syzkaller" flags: 0xfff0000002003c(referenced|uptodate|dirty|lru|swapbacked|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff0000002003c ffffea00016dc148 ffffea0001672ec8 ffff888033f87930 raw: 00000000000003f7 0000000000000000 00000001ffffffff ffff888011d2a000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 8492, tgid 8465 (syz.2.281), ts 133144228663, free_ts 133020506478 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558 prep_new_page mm/page_alloc.c:1566 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3476 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753 alloc_pages_mpol_noprof+0x3e1/0x780 mm/mempolicy.c:2269 folio_alloc_mpol_noprof+0x36/0x50 mm/mempolicy.c:2288 shmem_alloc_folio mm/shmem.c:1799 [inline] shmem_alloc_and_add_folio+0x4a0/0x1080 mm/shmem.c:1838 shmem_get_folio_gfp+0x621/0x1840 mm/shmem.c:2358 shmem_get_folio mm/shmem.c:2464 [inline] shmem_write_begin+0x165/0x350 mm/shmem.c:3120 generic_perform_write+0x346/0x990 mm/filemap.c:4132 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3296 new_sync_write fs/read_write.c:586 [inline] vfs_write+0xacf/0xd10 fs/read_write.c:679 ksys_write+0x18f/0x2b0 fs/read_write.c:731 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 page last free pid 8480 tgid 8479 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_folios+0xe23/0x1890 mm/page_alloc.c:2706 folios_put_refs+0x76c/0x860 mm/swap.c:962 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x593/0x1820 mm/shmem.c:1044 shmem_truncate_range mm/shmem.c:1156 [inline] shmem_evict_inode+0x29b/0xa80 mm/shmem.c:1284 evict+0x4e8/0x9a0 fs/inode.c:796 __dentry_kill+0x20d/0x630 fs/dcache.c:625 dput+0x19f/0x2b0 fs/dcache.c:867 __fput+0x60b/0x9f0 fs/file_table.c:458 __do_sys_close fs/open.c:1579 [inline] __se_sys_close fs/open.c:1564 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1564 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 Memory state around the buggy address: ffff88805b703f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805b703f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805b704000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88805b704080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805b704100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================