From 8f25f1b51315b2f68b2c9bbaa6a3a28be26854d8 Mon Sep 17 00:00:00 2001 From: Gabriel Krisman Bertazi Date: Fri, 30 Nov 2018 19:39:08 -0500 Subject: [PATCH] tune2fs: prevent enabling encryption flag on encoding-aware fs The kernel will refuse to mount filesystems with the encryption and encoding features enabled at the same time. The encoding feature can only be set at mke2fs time, so we can just prevent encryption from being set at a later time by tune2fs. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Theodore Ts'o --- misc/tune2fs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index cd4057c34..fbdf78a8f 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -1401,6 +1401,12 @@ mmp_error: } if (FEATURE_ON(E2P_FEATURE_INCOMPAT, EXT4_FEATURE_INCOMPAT_ENCRYPT)) { + if (ext2fs_has_feature_fname_encoding(sb)) { + fputs(_("Cannot enable encrypt feature on filesystems " + "with the encoding feature enabled.\n"), + stderr); + return 1; + } fs->super->s_encrypt_algos[0] = EXT4_ENCRYPTION_MODE_AES_256_XTS; fs->super->s_encrypt_algos[1] = -- 2.47.2