Thread (2 messages) 2 messages, 2 authors, 2015-06-13

[PATCH] ext4 crypto: prevent mount when blocksize != pagesize

From: Seunghun Lee <hidden>
Date: 2015-06-11 15:31:13
Also in: lkml
Subsystem: ext4 file system, filesystems (vfs and infrastructure), the rest · Maintainers: "Theodore Ts'o", Alexander Viro, Christian Brauner, Linus Torvalds

Encryption mode is unsupported when blocksize != pagesize.

Signed-off-by: Seunghun Lee <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help