================================================================== BUG: KASAN: use-after-free in ext4_ext_insert_extent+0x3c13/0x4530 fs/ext4/extents.c:2071 Read of size 4 at addr ffff888131da3044 by task syz.2.18/521 CPU: 1 PID: 521 Comm: syz.2.18 Not tainted 5.10.238-syzkaller-1007479-gd76d4cd0623a #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:2058 [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:0x7f1c6cf8b169 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:00007f1c6c9dc038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f1c6d1a4080 RCX: 00007f1c6cf8b169 RDX: 0000000000040010 RSI: 0000400000000180 RDI: 0000000000000006 RBP: 00007f1c6d00c2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f1c6d1a4080 R15: 00007fff6d032128 The buggy address belongs to the page: page:ffffea0004c768c0 refcount:1 mapcount:1 mapping:0000000000000000 index:0x4000009a8 pfn:0x131da3 anon flags: 0x4000000000080014(uptodate|lru|swapbacked) raw: 4000000000080014 ffffea0004c76888 ffffea0004c76908 ffff88810d3f35c1 raw: 00000004000009a8 0000000000000000 0000000100000000 ffff888104fba000 page dumped because: kasan: bad access detected page->mem_cgroup:ffff888104fba000 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 498, ts 51019200210, free_ts 0 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_owner free stack trace missing Memory state around the buggy address: ffff888131da2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888131da2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888131da3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff888131da3080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888131da3100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== EXT4-fs error (device loop2): ext4_ext_split:1144: inode #17: comm syz.2.18: eh_entries 39003 != eh_max 31161! EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 157175582775404, count = 14464 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 73707468559677, count = 26223 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 95700529768890, count = 14910 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 170656815690709, count = 13426 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 72253929382174, count = 22019 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 171490992868567, count = 17928 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 137830222488630, count = 7047 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 212376966284886, count = 28304 EXT4-fs error (device loop2): ext4_free_blocks:5685: comm syz.2.18: Freeing blocks not in datazone - block = 163912754272793, count = 29598