]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext4 crypto: validate context consistency on lookup
authorTheodore Ts'o <tytso@mit.edu>
Wed, 8 Apr 2015 04:19:28 +0000 (00:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 8 Apr 2015 04:19:28 +0000 (00:19 -0400)
Change-Id: Ifb904b2bec9300b178062ee70cbdfd333f03f865
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/namei.c

index 0dbd2d2937f76b7de364526797f00fce26c48050..30cd7dec2015432d8b981c14717f7cc42bc5e795 100644 (file)
@@ -1417,6 +1417,13 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
                        return ERR_PTR(-EIO);
                }
        }
+       if (ext4_encrypted_inode(dir) &&
+           !ext4_is_child_context_consistent_with_parent(dir,
+                                                         dentry->d_inode)) {
+               printk(KERN_ERR "%s: Security warning: Inconsistent contexts\n",
+                      __func__);
+               return ERR_PTR(-EINVAL);
+       }
        return d_splice_alias(inode, dentry);
 }