================================================================== BUG: KASAN: use-after-free in ext4_ext_insert_extent+0x3c13/0x4530 fs/ext4/extents.c:2071 Read of size 4 at addr ffff8881330be62c by task syz.7.32/553 CPU: 0 PID: 553 Comm: syz.7.32 Not tainted 5.10.238-syzkaller-1007487-g59e9a7228857 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0xe2/0x130 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_insert_extent+0x3c13/0x4530 fs/ext4/extents.c:2071 ext4_ext_map_blocks+0x148c/0x5d40 fs/ext4/extents.c:4354 ext4_map_blocks+0x978/0x1bc0 fs/ext4/inode.c:674 _ext4_get_block+0x1bb/0x4b0 fs/ext4/inode.c:817 ext4_get_block+0x39/0x50 fs/ext4/inode.c:834 ext4_block_write_begin+0x567/0x1330 fs/ext4/inode.c:1101 ext4_write_begin+0x651/0x1550 fs/ext4/ext4_jbd2.h:-1 ext4_da_write_begin+0x455/0xe80 fs/ext4/inode.c:3033 generic_perform_write+0x2be/0x510 mm/filemap.c:3509 ext4_buffered_write_iter+0x4b8/0x640 fs/ext4/file.c:271 ext4_file_write_iter+0x536/0x1980 fs/ext4/file.c:-1 call_write_iter include/linux/fs.h:2066 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0x725/0xd60 fs/read_write.c:605 ksys_write+0x140/0x240 fs/read_write.c:658 __do_sys_write fs/read_write.c:670 [inline] __se_sys_write fs/read_write.c:667 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:667 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f23122c0169 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:00007f2311d11038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f23124d9080 RCX: 00007f23122c0169 RDX: 0000000000040010 RSI: 0000400000000180 RDI: 0000000000000006 RBP: 00007f23123412a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f23124d9080 R15: 00007fff27ec2618 The buggy address belongs to the page: page:ffffea0004cc2f80 refcount:1 mapcount:1 mapping:0000000000000000 index:0x4000001cf pfn:0x1330be anon flags: 0x4000000000080014(uptodate|lru|swapbacked) raw: 4000000000080014 ffffea0004cc2f48 ffffea0004cc2fc8 ffff88810d8268a1 raw: 00000004000001cf 0000000000000000 0000000100000000 ffff88812b13e000 page dumped because: kasan: bad access detected page->mem_cgroup:ffff88812b13e000 page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x8100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO|0x8000000), pid 549, ts 59339059455, free_ts 56630475245 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x179/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5357 __alloc_pages include/linux/gfp.h:544 [inline] __alloc_pages_node include/linux/gfp.h:557 [inline] alloc_pages_node include/linux/gfp.h:571 [inline] alloc_pages include/linux/gfp.h:590 [inline] do_anonymous_page mm/memory.c:3963 [inline] handle_pte_fault+0x1719/0x3750 mm/memory.c:4786 __handle_mm_fault mm/memory.c:4944 [inline] handle_mm_fault+0xf3f/0x16a0 mm/memory.c:5358 do_user_addr_fault+0x5a2/0xc80 arch/x86/mm/fault.c:1362 handle_page_fault arch/x86/mm/fault.c:1428 [inline] exc_page_fault+0x5a/0xc0 arch/x86/mm/fault.c:1484 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336 free_unref_page_list+0x12e/0x9b0 mm/page_alloc.c:3443 release_pages+0xe38/0xe80 mm/swap.c:1103 free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:356 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:240 [inline] tlb_flush_mmu mm/mmu_gather.c:247 [inline] tlb_finish_mmu+0x175/0x300 mm/mmu_gather.c:326 exit_mmap+0x2fc/0x540 mm/mmap.c:3375 __mmput+0x93/0x2f0 kernel/fork.c:1153 mmput+0x4e/0x150 kernel/fork.c:1176 exit_mm kernel/exit.c:539 [inline] do_exit+0x986/0x2470 kernel/exit.c:850 do_group_exit+0x141/0x310 kernel/exit.c:985 get_signal+0xf7d/0x12e0 kernel/signal.c:2793 arch_do_signal_or_restart+0xbf/0x10f0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0xa2/0xe0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff8881330be500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881330be580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8881330be600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff8881330be680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881330be700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== EXT4-fs error (device loop7): ext4_ext_split:1144: inode #17: comm syz.7.32: eh_entries 53465 != eh_max 47832! EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 179437985637509, count = 7057 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 132272538050166, count = 13130 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 83698730096234, count = 8612 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 103204484987874, count = 7561 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 8705292938711, count = 26080 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 272229254853338, count = 28693 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 98070910920885, count = 762 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 162363611384631, count = 20826 EXT4-fs error (device loop7): ext4_free_blocks:5685: comm syz.7.32: Freeing blocks not in datazone - block = 117189865845976, count = 25390