================================================================== BUG: KASAN: use-after-free in sanity_check_extent_cache+0x228/0x2e8 fs/f2fs/extent_cache.c:35 Read of size 4 at addr ffff0000e25ae080 by task syz.2.18/5343 CPU: 1 PID: 5343 Comm: syz.2.18 Not tainted 6.1.143-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack+0x30/0x40 lib/dump_stack.c:88 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106 print_address_description+0x88/0x220 mm/kasan/report.c:316 print_report+0x50/0x68 mm/kasan/report.c:427 kasan_report+0xa8/0x100 mm/kasan/report.c:531 __asan_report_load4_noabort+0x2c/0x38 mm/kasan/report_generic.c:350 sanity_check_extent_cache+0x228/0x2e8 fs/f2fs/extent_cache.c:35 do_read_inode fs/f2fs/inode.c:454 [inline] f2fs_iget+0x2cfc/0x472c fs/f2fs/inode.c:505 f2fs_nfs_get_inode+0x80/0x118 fs/f2fs/super.c:3157 generic_fh_to_dentry+0x9c/0x104 fs/libfs.c:1072 f2fs_fh_to_dentry+0x44/0x58 fs/f2fs/super.c:3171 exportfs_decode_fh_raw+0x11c/0x548 fs/exportfs/expfs.c:435 exportfs_decode_fh+0x50/0x80 fs/exportfs/expfs.c:575 do_handle_to_path fs/fhandle.c:152 [inline] handle_to_path fs/fhandle.c:207 [inline] do_handle_open+0x4c0/0x894 fs/fhandle.c:223 __do_sys_open_by_handle_at fs/fhandle.c:265 [inline] __se_sys_open_by_handle_at fs/fhandle.c:256 [inline] __arm64_sys_open_by_handle_at+0x80/0x94 fs/fhandle.c:256 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 Allocated by task 5314: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:52 kasan_save_alloc_info+0x28/0x34 mm/kasan/generic.c:505 __kasan_slab_alloc+0x70/0x88 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x74/0x43c mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x234/0x318 mm/slub.c:3422 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2787 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2797 [inline] __grab_extent_tree+0x160/0x3a8 fs/f2fs/extent_cache.c:384 f2fs_init_read_extent_tree+0x210/0x718 fs/f2fs/extent_cache.c:455 do_read_inode fs/f2fs/inode.c:452 [inline] f2fs_iget+0x2cf4/0x472c fs/f2fs/inode.c:505 f2fs_nfs_get_inode+0x80/0x118 fs/f2fs/super.c:3157 generic_fh_to_dentry+0x9c/0x104 fs/libfs.c:1072 f2fs_fh_to_dentry+0x44/0x58 fs/f2fs/super.c:3171 exportfs_decode_fh_raw+0x11c/0x548 fs/exportfs/expfs.c:435 exportfs_decode_fh+0x50/0x80 fs/exportfs/expfs.c:575 do_handle_to_path fs/fhandle.c:152 [inline] handle_to_path fs/fhandle.c:207 [inline] do_handle_open+0x4c0/0x894 fs/fhandle.c:223 __do_sys_open_by_handle_at fs/fhandle.c:265 [inline] __se_sys_open_by_handle_at fs/fhandle.c:256 [inline] __arm64_sys_open_by_handle_at+0x80/0x94 fs/fhandle.c:256 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 Freed by task 5314: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:52 kasan_save_free_info+0x3c/0x60 mm/kasan/generic.c:516 ____kasan_slab_free+0x148/0x1b0 mm/kasan/common.c:236 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x16c/0x1ec mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0x11c/0x324 mm/slub.c:3683 __destroy_extent_tree fs/f2fs/extent_cache.c:1011 [inline] f2fs_destroy_extent_tree+0x2d0/0x6f0 fs/f2fs/extent_cache.c:1022 f2fs_evict_inode+0x3d4/0x153c fs/f2fs/inode.c:774 evict+0x3c8/0x810 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x764/0x7f4 fs/inode.c:1860 iget_failed+0x148/0x194 fs/bad_inode.c:250 f2fs_iget+0x1cd0/0x472c fs/f2fs/inode.c:558 f2fs_nfs_get_inode+0x80/0x118 fs/f2fs/super.c:3157 generic_fh_to_dentry+0x9c/0x104 fs/libfs.c:1072 f2fs_fh_to_dentry+0x44/0x58 fs/f2fs/super.c:3171 exportfs_decode_fh_raw+0x11c/0x548 fs/exportfs/expfs.c:435 exportfs_decode_fh+0x50/0x80 fs/exportfs/expfs.c:575 do_handle_to_path fs/fhandle.c:152 [inline] handle_to_path fs/fhandle.c:207 [inline] do_handle_open+0x4c0/0x894 fs/fhandle.c:223 __do_sys_open_by_handle_at fs/fhandle.c:265 [inline] __se_sys_open_by_handle_at fs/fhandle.c:256 [inline] __arm64_sys_open_by_handle_at+0x80/0x94 fs/fhandle.c:256 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 The buggy address belongs to the object at ffff0000e25ae000 which belongs to the cache f2fs_extent_tree of size 136 The buggy address is located 128 bytes inside of 136-byte region [ffff0000e25ae000, ffff0000e25ae088) The buggy address belongs to the physical page: page:000000006a2a3e46 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1225ae flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000000200 0000000000000000 dead000000000122 ffff0000c7497080 raw: 0000000000000000 0000000080140014 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000e25adf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000e25ae000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000e25ae080: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff0000e25ae100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000e25ae180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== F2FS-fs (loop2): sanity_check_extent_cache: inode (ino=8) extent info [5634, 0, 3] is incorrect, run fsck to fix