Skip to content

Commit

Permalink
ext4 crypto: policies may only be set on directories
Browse files Browse the repository at this point in the history
Thanks to Chao Yu <[email protected]> for pointing out we were
missing this check.

Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
tytso committed May 31, 2015
1 parent c2facca commit d87f6d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ext4/crypto_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d87f6d7

Please sign in to comment.