EXT4-fs error (device loop2): ext4_mb_generate_buddy:1098: group 0, block bitmap and bg descriptor inconsistent: 4067 vs 220 free clusters ================================================================== BUG: KASAN: use-after-free in crc16+0x1fb/0x280 lib/crc16.c:58 Read of size 1 at addr ffff888021bd3000 by task syz-executor.2/16528 CPU: 0 PID: 16528 Comm: syz-executor.2 Not tainted 6.4.0-rc1-syzkaller-00001-gba0ad6ed89fd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 crc16+0x1fb/0x280 lib/crc16.c:58 ext4_group_desc_csum+0x90f/0xc50 fs/ext4/super.c:3243 ext4_group_desc_csum_set+0x19b/0x240 fs/ext4/super.c:3266 ext4_mb_clear_bb fs/ext4/mballoc.c:6206 [inline] ext4_free_blocks+0x1ae2/0x2d60 fs/ext4/mballoc.c:6352 ext4_clear_blocks+0x334/0x3a0 fs/ext4/indirect.c:887 ext4_free_data fs/ext4/indirect.c:961 [inline] ext4_ind_truncate+0x76b/0xd60 fs/ext4/indirect.c:1153 ext4_truncate+0x9df/0x1150 fs/ext4/inode.c:4153 ext4_setattr+0x1196/0x1bc0 fs/ext4/inode.c:5434 notify_change+0xc8b/0xf40 fs/attr.c:483 do_truncate+0x220/0x300 fs/open.c:66 handle_truncate fs/namei.c:3295 [inline] do_open fs/namei.c:3640 [inline] path_openat+0x294e/0x3170 fs/namei.c:3791 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_open fs/open.c:1380 [inline] __se_sys_open fs/open.c:1376 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1376 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f8003a8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f80048a2168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f8003babf80 RCX: 00007f8003a8c169 RDX: 0000000000000000 RSI: 0000000000000600 RDI: 0000000020000040 RBP: 00007f8003ae7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffee33cd7f R14: 00007f80048a2300 R15: 0000000000022000 The buggy address belongs to the physical page: page:ffffea000086f4c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21bd3 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 ffffea0000936508 ffffea0001cc7f08 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x140c40(GFP_NOFS|__GFP_COMP|__GFP_HARDWALL), pid 16478, tgid 16477 (syz-executor.4), ts 569718089569, free_ts 570102115425 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 folio_alloc+0x1e/0x60 mm/mempolicy.c:2289 filemap_alloc_folio+0xde/0x500 mm/filemap.c:976 __filemap_get_folio+0x323/0xa00 mm/filemap.c:1965 pagecache_get_page+0x2e/0x220 mm/folio-compat.c:99 f2fs_get_read_data_page+0xe0/0x850 fs/f2fs/data.c:1226 f2fs_find_data_page+0x9d/0x390 fs/f2fs/data.c:1309 find_in_level fs/f2fs/dir.c:323 [inline] __f2fs_find_entry+0x619/0xcc0 fs/f2fs/dir.c:388 f2fs_lookup+0x303/0xa40 fs/f2fs/namei.c:526 lookup_open fs/namei.c:3470 [inline] open_last_lookups fs/namei.c:3560 [inline] path_openat+0x11e9/0x3170 fs/namei.c:3788 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_open fs/open.c:1380 [inline] __se_sys_open fs/open.c:1376 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1376 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page_list+0x596/0x830 mm/page_alloc.c:2705 release_pages+0x2193/0x2470 mm/swap.c:1042 __pagevec_release+0x84/0x100 mm/swap.c:1062 pagevec_release include/linux/pagevec.h:63 [inline] folio_batch_release include/linux/pagevec.h:132 [inline] truncate_inode_pages_range+0x45d/0x11b0 mm/truncate.c:372 f2fs_evict_inode+0x1bf/0x1590 fs/f2fs/inode.c:782 evict+0x2a4/0x620 fs/inode.c:665 dispose_list fs/inode.c:698 [inline] evict_inodes+0x5f8/0x690 fs/inode.c:748 generic_shutdown_super+0x98/0x340 fs/super.c:479 kill_block_super+0x84/0xf0 fs/super.c:1407 kill_f2fs_super+0x303/0x3d0 fs/f2fs/super.c:4702 deactivate_locked_super+0xa4/0x110 fs/super.c:331 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1177 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 Memory state around the buggy address: ffff888021bd2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888021bd2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888021bd3000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888021bd3080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888021bd3100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================