]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tune2fs: prevent enabling encryption flag on encoding-aware fs
authorGabriel Krisman Bertazi <krisman@collabora.co.uk>
Sat, 1 Dec 2018 00:39:08 +0000 (19:39 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 3 Dec 2018 05:00:49 +0000 (00:00 -0500)
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 <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/tune2fs.c

index cd4057c34f0e0a34d788f06084ba82d4fd729b99..fbdf78a8f849d130a1e1625eca86b52e87620668 100644 (file)
@@ -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] =