]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ext4 crypto: policies may only be set on directories
authorTheodore Ts'o <tytso@mit.edu>
Sun, 31 May 2015 17:35:14 +0000 (13:35 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 31 May 2015 17:35:14 +0000 (13:35 -0400)
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>
fs/ext4/crypto_policy.c

index 81980a158dc71e2d298ce92381a57514c6cf4953..a1d434d0dea8f89686e236e18d566500cc7c0185 100644 (file)
@@ -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,