Encryption mode is unsupported when blocksize != pagesize.

Signed-off-by: Seunghun Lee <way...@gmail.com>
---
 fs/ext4/super.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 31e85be..032c9e3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1583,6 +1583,15 @@ static int handle_mount_opt(struct super_block *sb, char 
*opt, int token,
                        IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
        } else if (token == Opt_test_dummy_encryption) {
 #ifdef CONFIG_EXT4_FS_ENCRYPTION
+               int blocksize =
+                       BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
+
+               if (blocksize != PAGE_CACHE_SIZE) {
+                       ext4_msg(sb, KERN_ERR,
+                               "unsupported blocksize for Test dummy 
encryption mode");
+                       return -1;
+               }
+
                sbi->s_mount_flags |= EXT4_MF_TEST_DUMMY_ENCRYPTION;
                ext4_msg(sb, KERN_WARNING,
                         "Test dummy encryption mode enabled");
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to