Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7b6e8af authored by Jin Qian's avatar Jin Qian Committed by Gerrit - the friendly Code Review server
Browse files

BACKPORT: f2fs: sanity check log_blocks_per_seg



f2fs currently only supports 4KB block size and 2MB segment size.
Sanity check log_blocks_per_seg == 9, i.e. 2MB/4KB = (1 << 9)

Partially
(cherry-picked from commit 9a59b62fd88196844cee5fff851bee2cfd7afb6e)

f2fs: do more integrity verification for superblock

Do more sanity check for superblock during ->mount.

Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>

Signed-off-by: default avatarJin Qian <jinqian@google.com>
Bug: 36817013
Change-Id: I0be52e54fba82083068337ceb9f7ad985a87319f
Git-repo: https://android.googlesource.com/kernel/common


Git-commit: 3c1659a14b13e66d1d1ab926e242489bda494752
Signed-off-by: default avatarDennis Cagle <dcagle@codeaurora.org>
parent 618e373e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1454,6 +1454,14 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
		return 1;
	}

	/* check log blocks per segment */
	if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
		f2fs_msg(sb, KERN_INFO,
			"Invalid log blocks per segment (%u)\n",
			le32_to_cpu(raw_super->log_blocks_per_seg));
		return 1;
	}

	/* Currently, support 512/1024/2048/4096 bytes sector size */
	if (le32_to_cpu(raw_super->log_sectorsize) >
				F2FS_MAX_LOG_SECTOR_SIZE ||