linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seunghun Lee <waydi1@gmail.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	Seunghun Lee <waydi1@gmail.com>
Subject: [PATCH] ext4 crypto: prevent mount when blocksize != pagesize
Date: Fri, 12 Jun 2015 00:12:47 +0900	[thread overview]
Message-ID: <1434035567-12651-1-git-send-email-waydi1@gmail.com> (raw)

Encryption mode is unsupported when blocksize != pagesize.

Signed-off-by: Seunghun Lee <waydi1@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


             reply	other threads:[~2015-06-11 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 15:12 Seunghun Lee [this message]
2015-06-13  3:45 ` [PATCH] ext4 crypto: prevent mount when blocksize != pagesize Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434035567-12651-1-git-send-email-waydi1@gmail.com \
    --to=waydi1@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).