From: Gabriel Krisman Bertazi Date: Sat, 1 Dec 2018 00:39:08 +0000 (-0500) Subject: tune2fs: prevent enabling encryption flag on encoding-aware fs X-Git-Tag: v1.45.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f25f1b51315b2f68b2c9bbaa6a3a28be26854d8;p=thirdparty%2Fe2fsprogs.git 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 --- 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] =