EXT4-fs (loop1): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) ================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:946 Read of size 4 at addr ffff88812404a9c8 by task kworker/u4:4/482 CPU: 1 PID: 482 Comm: kworker/u4:4 Not tainted 5.15.76-syzkaller-00628-g92f701cae0bc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3d0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:827 [inline] ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x22d/0x3cb0 fs/ext4/extents.c:4103 ext4_map_blocks+0xacd/0x1e20 fs/ext4/inode.c:640 ext4_convert_unwritten_extents+0x2ed/0x6e0 fs/ext4/extents.c:4818 ext4_convert_unwritten_io_end_vec+0x11d/0x1d0 fs/ext4/extents.c:4857 ext4_end_io_end fs/ext4/page-io.c:186 [inline] ext4_do_flush_completed_IO fs/ext4/page-io.c:259 [inline] ext4_end_io_rsv_work+0x3a0/0x740 fs/ext4/page-io.c:273 process_one_work+0x6db/0xc00 kernel/workqueue.c:2313 worker_thread+0xb3e/0x1340 kernel/workqueue.c:2460 kthread+0x41c/0x500 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the page: page:ffffea0004901280 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x12404a flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00049012c8 ffffea0004901248 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 483, ts 24109790125, free_ts 24292841718 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495 prep_new_page mm/page_alloc.c:2501 [inline] get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] __page_cache_alloc include/linux/pagemap.h:305 [inline] pagecache_get_page+0xa60/0xdb0 mm/filemap.c:1940 grab_cache_page_write_begin+0x5c/0xa0 mm/filemap.c:3779 ext4_write_begin+0x292/0x1360 fs/ext4/inode.c:1188 ext4_da_write_begin+0x4ac/0xbf0 fs/ext4/inode.c:2979 generic_perform_write+0x2cd/0x5d0 mm/filemap.c:3825 ext4_buffered_write_iter+0x49b/0x630 fs/ext4/file.c:271 ext4_file_write_iter+0x448/0x1cc0 call_write_iter include/linux/fs.h:2129 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xc8d/0x1050 fs/read_write.c:594 ksys_write+0x198/0x2c0 fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:656 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1364 [inline] free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435 free_unref_page_prepare mm/page_alloc.c:3433 [inline] free_unref_page_list+0x16a/0xad0 mm/page_alloc.c:3554 release_pages+0xf3e/0xf90 mm/swap.c:1010 __pagevec_release+0x81/0xf0 mm/swap.c:1030 pagevec_release include/linux/pagevec.h:81 [inline] truncate_inode_pages_range+0x4b2/0x1150 mm/truncate.c:329 truncate_inode_pages mm/truncate.c:425 [inline] truncate_inode_pages_final+0x83/0x90 mm/truncate.c:464 ext4_evict_inode+0x3e9/0x1470 fs/ext4/inode.c:214 evict+0x2a3/0x630 fs/inode.c:587 dispose_list fs/inode.c:620 [inline] evict_inodes+0x638/0x6c0 fs/inode.c:670 generic_shutdown_super+0x9c/0x2d0 fs/super.c:454 kill_block_super+0x80/0xe0 fs/super.c:1395 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1143 __cleanup_mnt+0x19/0x20 fs/namespace.c:1150 task_work_run+0x147/0x1b0 kernel/task_work.c:164 Memory state around the buggy address: ffff88812404a880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88812404a900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88812404a980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88812404aa00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88812404aa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop1): ext4_map_blocks:720: inode #19: block 44: comm kworker/u4:4: lblock 44 mapped to illegal pblock 44 (length 1) EXT4-fs warning (device loop1): ext4_convert_unwritten_extents:4825: inode #19: block 44: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop1) in ext4_reserve_inode_write:5783: Out of memory EXT4-fs error (device loop1): ext4_convert_unwritten_extents:4826: inode #19: comm kworker/u4:4: mark_inode_dirty error EXT4-fs (loop1): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs error (device loop1): ext4_map_blocks:720: inode #19: block 45: comm kworker/u4:4: lblock 45 mapped to illegal pblock 45 (length 1) EXT4-fs warning (device loop1): ext4_convert_unwritten_extents:4825: inode #19: block 45: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop1): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs warning (device loop1): ext4_convert_unwritten_extents:4825: inode #19: block 46: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop1): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117)