From: Theodore Ts'o Date: Wed, 8 Apr 2015 04:19:28 +0000 (-0400) Subject: ext4 crypto: validate context consistency on lookup X-Git-Tag: KARO-TXA5-2015-06-26~116^2~11 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bcd90eaf1208ec309843bff62a04aeeab2b4d220;p=karo-tx-linux.git ext4 crypto: validate context consistency on lookup Change-Id: Ifb904b2bec9300b178062ee70cbdfd333f03f865 Signed-off-by: Michael Halcrow Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 0dbd2d2937f7..30cd7dec2015 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -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); }