From: Theodore Ts'o Date: Sat, 13 Jun 2015 03:44:33 +0000 (-0400) Subject: ext4 crypto: fail the mount if blocksize != pagesize X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1cb767cd4a79703105f4f3774c76896d621fdc54;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ext4 crypto: fail the mount if blocksize != pagesize We currently don't correctly handle the case where blocksize != pagesize, so disallow the mount in those cases. Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 31e85bea9652..e13fe40d4a51 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4065,7 +4065,15 @@ no_journal: } } - if (unlikely(sbi->s_mount_flags & EXT4_MF_TEST_DUMMY_ENCRYPTION) && + if ((DUMMY_ENCRYPTION_ENABLED(sbi) || + EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) && + (blocksize != PAGE_CACHE_SIZE)) { + ext4_msg(sb, KERN_ERR, + "Unsupported blocksize for fs encryption"); + goto failed_mount_wq; + } + + if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) { EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT);