From d5d0e8c7203a41c01ba05f4e053e16a94ce3c2e1 Mon Sep 17 00:00:00 2001 From: Michael Halcrow Date: Sun, 12 Apr 2015 00:56:17 -0400 Subject: ext4 crypto: filename encryption facilities Signed-off-by: Uday Savagaonkar Signed-off-by: Ildar Muslukhov Signed-off-by: Michael Halcrow Signed-off-by: Theodore Ts'o --- fs/ext4/crypto_policy.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fs/ext4/crypto_policy.c') 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); -- cgit v1.2.3