From 6f94ab6656ceffb3f2a972c8de4c554502b6f2b7 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 22 Jul 2016 17:59:11 -0400 Subject: 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 Cc: Simon Glass Cc: Lukasz Majewski Cc: Stefan Roese Reported-by: Andrew Bradford Signed-off-by: Tom Rini --- fs/ext4/ext4_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'fs') diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 40b798a43f..eb49fce04c 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -2229,6 +2229,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 -- cgit v1.2.3