summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-31 19:35:14 +0200
committerTheodore Ts'o <tytso@mit.edu>2015-05-31 19:35:14 +0200
commitd87f6d78e996bbba27b649c0e0eed7a37d6b73ba (patch)
treeeaa222a7983424b95dc6d5b6ed268266e5aa1af9
parentext4 crypto: enforce crypto policy restrictions on cross-renames (diff)
downloadlinux-d87f6d78e996bbba27b649c0e0eed7a37d6b73ba.tar.xz
linux-d87f6d78e996bbba27b649c0e0eed7a37d6b73ba.zip
ext4 crypto: policies may only be set on directories
Thanks to Chao Yu <chao2.yu@samsung.com> for pointing out we were missing this check. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/crypto_policy.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/crypto_policy.c b/fs/ext4/crypto_policy.c
index 81980a158dc7..a1d434d0dea8 100644
--- a/fs/ext4/crypto_policy.c
+++ b/fs/ext4/crypto_policy.c
@@ -93,6 +93,8 @@ int ext4_process_policy(const struct ext4_encryption_policy *policy,
return -EINVAL;
if (!ext4_inode_has_encryption_context(inode)) {
+ if (!S_ISDIR(inode->i_mode))
+ return -EINVAL;
if (!ext4_empty_dir(inode))
return -ENOTEMPTY;
return ext4_create_encryption_context_from_policy(inode,