Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932658AbbEKSVF (ORCPT ); Mon, 11 May 2015 14:21:05 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:47423 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755018AbbEKSI0 (ORCPT ); Mon, 11 May 2015 14:08:26 -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 081/110] namei: move bumping the refcount of link->mnt into pick_link() Date: Mon, 11 May 2015 19:07:41 +0100 Message-Id: <1431367690-5223-81-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: 1368 Lines: 53 From: Al Viro update the failure cleanup in may_follow_link() to match that. Signed-off-by: Al Viro --- fs/namei.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 55283fe..05efcc0 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -802,7 +802,7 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) return 0; audit_log_link_denied("follow_link", link); - path_put_conditional(link, nd); + path_put(link); path_put(&nd->path); return -EACCES; } @@ -887,9 +887,6 @@ const char *get_link(struct nameidata *nd) BUG_ON(nd->flags & LOOKUP_RCU); - if (nd->link.mnt == nd->path.mnt) - mntget(nd->link.mnt); - last->link = nd->link; last->cookie = NULL; nd->depth++; @@ -1574,9 +1571,11 @@ static int pick_link(struct nameidata *nd, struct path *link) return -ECHILD; } } + if (link->mnt == nd->path.mnt) + mntget(link->mnt); error = nd_alloc_stack(nd); if (unlikely(error)) { - path_to_nameidata(link, nd); + path_put(link); return error; } -- 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/