mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-30 01:46:30 -05:00
45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
From 3f0531e5775303091a1ff975cdd572cc6a935321 Mon Sep 17 00:00:00 2001
|
|
From: Jin Qian <jinqian@google.com>
|
|
Date: Mon, 24 Apr 2017 18:20:52 -0700
|
|
Subject: [PATCH] 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: Chao Yu <chao2.yu@samsung.com>
|
|
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
Bug: 36817013
|
|
Change-Id: I0be52e54fba82083068337ceb9f7ad985a87319f
|
|
Signed-off-by: Jin Qian <jinqian@google.com>
|
|
---
|
|
fs/f2fs/super.c | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
|
|
index 3a65e01323528..98a77b0a365d9 100644
|
|
--- a/fs/f2fs/super.c
|
|
+++ b/fs/f2fs/super.c
|
|
@@ -947,6 +947,14 @@ static int sanity_check_raw_super(struct super_block *sb,
|
|
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 ||
|