From: Miklos Szeredi Date: Tue, 10 May 2016 23:16:37 +0000 (+0200) Subject: ovl: ignore permissions on underlying lookup X-Git-Tag: v4.1.12-108.0.20170806_1300~46 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e2936cfa70ed9af228526267d1c359f780f6f6e2;p=users%2Fjedix%2Flinux-maple.git ovl: ignore permissions on underlying lookup Generally permission checking is not necessary when overlayfs looks up a dentry on one of the underlying layers, since search permission on base directory was already checked in ovl_permission(). More specifically using lookup_one_len() causes a problem when the lower directory lacks search permission for a specific user while the upper directory does have search permission. Since lookups are cached, this causes inconsistency in behavior: success depends on who did the first lookup. So instead use lookup_hash() which doesn't do the permission check. Reported-by: Ignacy Gawędzki Signed-off-by: Miklos Szeredi Orabug: 26401569 (backport upstream commit 38b78a5f18584db6fa7441e0f4531b283b0e6725) Signed-off-by: Shan Hai Reviewed-by: Somasundaram Krishnasamy --- diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index fa4328c8f5b3..adf9b2642273 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -324,9 +324,7 @@ static inline struct dentry *ovl_lookup_real(struct dentry *dir, { struct dentry *dentry; - mutex_lock(&dir->d_inode->i_mutex); - dentry = lookup_one_len(name->name, dir, name->len); - mutex_unlock(&dir->d_inode->i_mutex); + dentry = lookup_hash(name, dir); if (IS_ERR(dentry)) { if (PTR_ERR(dentry) == -ENOENT)