Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1124959ybl; Sat, 18 Jan 2020 19:23:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxiYjwZ51bM/U91sLpjkCVjTqQ8zZFQBctNMoFEFZ+D2mjeZS3/ctaGWGbfXPxJuIwPnITA X-Received: by 2002:a9d:e83:: with SMTP id 3mr11584493otj.218.1579404203486; Sat, 18 Jan 2020 19:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579404203; cv=none; d=google.com; s=arc-20160816; b=xMx+CpEpa2ZuKCnaVsP4RvVF20PavUKBJmB/By3D7RNWh4Y0+Klt0eXQ/9EOf/11no aKzfPpNgHFisYuRmg8KDXaGhAuWN4QmQ6oyubMm69Jr73VKXOtSkRZAaFfQqaGYnLK+v bR+OeBHNxUIg6BJJEWt8/2JyfSp1VmJrC6NmpLPbC8RR4tXzt3w8MPVCi8shcKa/fupN fimPT25h8BzdodXFJK80Z+E6Uv/TPxngmrh1ep35u2O+GphL9W823qJ1hVF525g/W/it NIR6HaScWd1Ti1y6gVbTT3A9JL1+/IltQtbIKCxdIHavuvU33Zz4KXuzA046Y4FtfPOT +hmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kSLQJbGRegSccoAlTfHOIyOO1B25DgkfEwIUnbqYN14=; b=WScvo4QmsVkASjmwPZxwSILuhnnzmaQ0uDTreAQEITmW9PXjh1v++pz7BnsvgMtMVz YrA22P/X7WZjMgw2BY20myA1rQZAscuKzBJ8I82QVmIzZWEDTtPggfDtddwXwXi2fcLt TqgyP4eklfcfGYd6Op/GF07STIhM9n55GjYoZWeETBH57YokF49Rmm2oEFn6ck3y8FYp cpGRaZIaZdnhKWN+bMjCsqf0/y/NEbrtcL1R0TGom7N8c5gEp5il7/9hVJtDqWFYodxD Gfcwf/LkpG0HWiWPwe8dWHCk76doevPdpFgzxqRwtaqObeYYksoNI8s4w0xNX1GsMeTt 7tYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y18si16557448oix.27.2020.01.18.19.23.11; Sat, 18 Jan 2020 19:23:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgASDWR (ORCPT + 99 others); Sat, 18 Jan 2020 22:22:17 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:56846 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbgASDWR (ORCPT ); Sat, 18 Jan 2020 22:22:17 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1it19p-00BFcA-0A; Sun, 19 Jan 2020 03:21:54 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Aleksa Sarai , David Howells , Eric Biederman , Christian Brauner , Al Viro Subject: [PATCH 14/17] new step_into() flag: WALK_NOFOLLOW Date: Sun, 19 Jan 2020 03:17:26 +0000 Message-Id: <20200119031738.2681033-14-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> References: <20200119031423.GV8904@ZenIV.linux.org.uk> <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Tells step_into() not to follow symlinks, regardless of LOOKUP_FOLLOW. Allows to switch handle_lookup_down() to of step_into(), getting all follow_managed() and step_into() calls paired. Signed-off-by: Al Viro --- fs/namei.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index d529c1e138ff..44634643475d 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1713,7 +1713,7 @@ static int pick_link(struct nameidata *nd, struct path *link, return 1; } -enum {WALK_FOLLOW = 1, WALK_MORE = 2}; +enum {WALK_FOLLOW = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4}; /* * Do we need to follow links? We _really_ want to be able @@ -1727,7 +1727,8 @@ static inline int step_into(struct nameidata *nd, struct path *path, if (!(flags & WALK_MORE) && nd->depth) put_link(nd); if (likely(!d_is_symlink(path->dentry)) || - !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW)) { + !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW) || + flags & WALK_NOFOLLOW) { /* not a symlink or should not follow */ path_to_nameidata(path, nd); nd->inode = inode; @@ -2231,10 +2232,7 @@ static int handle_lookup_down(struct nameidata *nd) err = handle_mounts(nd, nd->path.dentry, &path, &inode, &seq); if (unlikely(err < 0)) return err; - path_to_nameidata(&path, nd); - nd->inode = inode; - nd->seq = seq; - return 0; + return step_into(nd, &path, WALK_NOFOLLOW, inode, seq); } /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ -- 2.20.1