diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d04b449978aa..49f5cb532738 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4650,6 +4650,13 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) sanity_check_seg_type(sbi, curseg->seg_type); + if (curseg->alloc_type != LFS && curseg->alloc_type != SSR) { + f2fs_err(sbi, + "Current segment has invalid alloc_type:%d", + curseg->alloc_type); + return -EFSCORRUPTED; + } + if (f2fs_test_bit(blkofs, se->cur_valid_map)) goto out;