Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbbFKPbN (ORCPT ); Thu, 11 Jun 2015 11:31:13 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34814 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbbFKPbK (ORCPT ); Thu, 11 Jun 2015 11:31:10 -0400 From: Seunghun Lee To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, Seunghun Lee Subject: [PATCH] ext4 crypto: prevent mount when blocksize != pagesize Date: Fri, 12 Jun 2015 00:12:47 +0900 Message-Id: <1434035567-12651-1-git-send-email-waydi1@gmail.com> X-Mailer: git-send-email 2.3.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 35 Encryption mode is unsupported when blocksize != pagesize. Signed-off-by: Seunghun Lee --- 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/