summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-07-23 00:59:11 +0300
committerDongjin Kim <tobetter@gmail.com>2020-02-10 16:44:41 +0300
commitf26a9cca514152889caf613a1d5b41fa247d21ff (patch)
tree00fa26176b1d263607db8934d6e8040c94427321
parente254a253459b2b4831d285d2e5eec6c753763482 (diff)
downloadu-boot-f26a9cca514152889caf613a1d5b41fa247d21ff.tar.xz
ext4: Refuse to mount filesystems with 64bit feature set
With e2fsprogs after 1.43 the 64bit and metadata_csum features are enabled by default. The metadata_csum feature changes how ext4_group_desc->bg_checksum is calculated, which would break write support. The 64bit feature however introduces changes such that it cannot be read by implementations that do not support it. Since we do not support this, we must not mount it. Cc: Stephen Warren <swarren@nvidia.com> Cc: Simon Glass <sjg@chromium.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stefan Roese <sr@denx.de> Reported-by: Andrew Bradford <andrew.bradford@kodakalaris.com> Signed-off-by: Tom Rini <trini@konsulko.com>
-rw-r--r--fs/ext4/ext4_common.c10
-rw-r--r--include/ext4fs.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index e5f498597f..1732cb2885 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -2232,6 +2232,16 @@ int ext4fs_mount(unsigned part_length)
if (__le16_to_cpu(data->sblock.magic) != EXT2_MAGIC)
goto fail;
+ /*
+ * The 64bit feature was enabled when metadata_csum was enabled
+ * and we do not support metadata_csum (and cannot reliably find
+ * files when it is set. Refuse to mount.
+ */
+ if (data->sblock.feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) {
+ printf("Unsupported feature found (64bit, possibly metadata_csum), not mounting\n");
+ goto fail;
+ }
+
if (__le32_to_cpu(data->sblock.revision_level == 0))
fs->inodesz = 128;
else
diff --git a/include/ext4fs.h b/include/ext4fs.h
index 6888adc56f..06cef783fa 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -32,6 +32,7 @@
#define EXT4_EXT_MAGIC 0xf30a
#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040
+#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
#define EXT4_INDIRECT_BLOCKS 12
#define EXT4_BG_INODE_UNINIT 0x0001