summaryrefslogtreecommitdiffstats
path: root/fs/ext4/crypto_policy.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@google.com>2015-04-12 00:56:17 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-04-12 00:56:17 -0400
commitd5d0e8c7203a41c01ba05f4e053e16a94ce3c2e1 (patch)
tree0d14b2319e623a924126ca4cd7da5cca09030f34 /fs/ext4/crypto_policy.c
parentc9c7429c2e486f375bddd0c338cc3ad366123717 (diff)
downloadtalos-op-linux-d5d0e8c7203a41c01ba05f4e053e16a94ce3c2e1.tar.gz
talos-op-linux-d5d0e8c7203a41c01ba05f4e053e16a94ce3c2e1.zip
ext4 crypto: filename encryption facilities
Signed-off-by: Uday Savagaonkar <savagaon@google.com> Signed-off-by: Ildar Muslukhov <ildarm@google.com> Signed-off-by: Michael Halcrow <mhalcrow@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/crypto_policy.c')
-rw-r--r--fs/ext4/crypto_policy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/crypto_policy.c b/fs/ext4/crypto_policy.c
index a4bf762b3ba9..749ed6e91e50 100644
--- a/fs/ext4/crypto_policy.c
+++ b/fs/ext4/crypto_policy.c
@@ -59,6 +59,13 @@ static int ext4_create_encryption_context_from_policy(
res = -EINVAL;
goto out;
}
+ if (!ext4_valid_filenames_enc_mode(policy->filenames_encryption_mode)) {
+ printk(KERN_WARNING
+ "%s: Invalid filenames encryption mode %d\n", __func__,
+ policy->filenames_encryption_mode);
+ res = -EINVAL;
+ goto out;
+ }
ctx.contents_encryption_mode = policy->contents_encryption_mode;
ctx.filenames_encryption_mode = policy->filenames_encryption_mode;
BUILD_BUG_ON(sizeof(ctx.nonce) != EXT4_KEY_DERIVATION_NONCE_SIZE);
OpenPOWER on IntegriCloud