Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932649AbbEKSTr (ORCPT ); Mon, 11 May 2015 14:19:47 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:47444 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755020AbbEKSI1 (ORCPT ); Mon, 11 May 2015 14:08:27 -0400 From: Al Viro To: Linus Torvalds Cc: Neil Brown , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 082/110] may_follow_link(): trim arguments Date: Mon, 11 May 2015 19:07:42 +0100 Message-Id: <1431367690-5223-82-git-send-email-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <20150511180650.GA4147@ZenIV.linux.org.uk> References: <20150511180650.GA4147@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2073 Lines: 65 From: Al Viro Signed-off-by: Al Viro --- fs/namei.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 05efcc0..82cb1bc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -765,7 +765,6 @@ int sysctl_protected_hardlinks __read_mostly = 0; /** * may_follow_link - Check symlink following for unsafe situations - * @link: The path of the symlink * @nd: nameidata pathwalk data * * In the case of the sysctl_protected_symlinks sysctl being enabled, @@ -779,7 +778,7 @@ int sysctl_protected_hardlinks __read_mostly = 0; * * Returns 0 if following the symlink is allowed, -ve on error. */ -static inline int may_follow_link(struct path *link, struct nameidata *nd) +static inline int may_follow_link(struct nameidata *nd) { const struct inode *inode; const struct inode *parent; @@ -788,7 +787,7 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) return 0; /* Allowed if owner and follower match. */ - inode = link->dentry->d_inode; + inode = nd->link.dentry->d_inode; if (uid_eq(current_cred()->fsuid, inode->i_uid)) return 0; @@ -801,8 +800,8 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) if (uid_eq(parent->i_uid, inode->i_uid)) return 0; - audit_log_link_denied("follow_link", link); - path_put(link); + audit_log_link_denied("follow_link", &nd->link); + path_put(&nd->link); path_put(&nd->path); return -EACCES; } @@ -1985,7 +1984,7 @@ static void path_cleanup(struct nameidata *nd) static int trailing_symlink(struct nameidata *nd) { const char *s; - int error = may_follow_link(&nd->link, nd); + int error = may_follow_link(nd); if (unlikely(error)) return error; nd->flags |= LOOKUP_PARENT; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/