Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp645894ybh; Tue, 10 Mar 2020 05:47:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuu7BskiqheoffxHWvfpaq12FZKNDkpTJFFgaJ1ZoJ8qJoKY6GBaxXvgZvOK+QLEdb1AF/3 X-Received: by 2002:a05:6830:1e09:: with SMTP id s9mr15784096otr.149.1583844454387; Tue, 10 Mar 2020 05:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583844454; cv=none; d=google.com; s=arc-20160816; b=EARSugISTSGvfS8P/5tfxRiH6cm9d6hzXY9bt1spj6Sub4qaFC/zeVISMiaUJWgigk 0YmsXVhkjSmMuXZU/muMrykrH53sY7AsorjGpMlWoWbgtlDq8YKaZXEluT36DwsWscc2 +9gbkELbtWp/UWqEyixoQCpo5rcm68DpZoiF+fSXJzgFWY4i1V2vrhe+QPXce5kYpAS+ qlbQJ2ZwbhPFbuFuxpnUt6/zRx6/Jb89tq6R6NuhsARJZCq+attX5eovp8nx8YrQfjgE Dj+d2GHv7toPQsMMdkgCO69YyQu+JJ/+x9bTDfIW24wDi14GzTsJ15l3DEWGlXGfAXPi rsJQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YFg6LK3l6LsaQCD4epzyIiZeEIuCG1p+b6O3gZlZxKY=; b=jos17QseNEBVuRfhXsbTCgrXvfUNANEVHcJ7VMaYVhCLKxsoZwQpehfm99juQ7Sbx+ T719LjjAQqZ+0ZOp2mcoflMYSFidLCRWKGJCCEhH88eIdlDKcXlFWKsmuI8A3QPIuz3/ z/Yij28SYT2574DAqMXepLAchCK44DCaiIutCppJPKgqsnjJWRnOlpvO9Q/UZzhG2Vnl iWIzGIVXvOx5aZk181HhCLODq02aBWvXWZOqhzfRzmOhSMWkTMYxLEDhJaHjNJO58C18 sqhUq5jJ7k7fu8jCcy4wOW/v/heAAAHNMuADat+AgW8x0r/nHYkj5nU26I2rkZLOthRM U1RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Msfsk2f7; 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 m7si5738441oie.138.2020.03.10.05.47.22; Tue, 10 Mar 2020 05:47:34 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Msfsk2f7; 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 S1727624AbgCJMpd (ORCPT + 99 others); Tue, 10 Mar 2020 08:45:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:48130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbgCJMp3 (ORCPT ); Tue, 10 Mar 2020 08:45:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2227A246A2; Tue, 10 Mar 2020 12:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583844328; bh=+cAswMxICauY55nftB9OIrbu+ADdoLTyXUMn+AqHzDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Msfsk2f7E3DvBE5IJ0AbBRHBmviI/nt4g/qM6BWJXA/OoWf57ImnEIpOaKRF8zYiF LJW5UyeVAkuj4uzZeFpAyNAQMOFgf81d+ex34MVWxJsDqUnp9/7SmeXbLsrM6AvDUd nBKKqFS7caJRJ0faSzXenI/potrZ2otAtl5feOnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Eric W. Biederman" , Al Viro , Aleksa Sarai Subject: [PATCH 4.9 42/88] namei: only return -ECHILD from follow_dotdot_rcu() Date: Tue, 10 Mar 2020 13:38:50 +0100 Message-Id: <20200310123616.295697790@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200310123606.543939933@linuxfoundation.org> References: <20200310123606.543939933@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aleksa Sarai commit 2b98149c2377bff12be5dd3ce02ae0506e2dd613 upstream. It's over-zealous to return hard errors under RCU-walk here, given that a REF-walk will be triggered for all other cases handling ".." under RCU. The original purpose of this check was to ensure that if a rename occurs such that a directory is moved outside of the bind-mount which the resolution started in, it would be detected and blocked to avoid being able to mess with paths outside of the bind-mount. However, triggering a new REF-walk is just as effective a solution. Cc: "Eric W. Biederman" Fixes: 397d425dc26d ("vfs: Test for and handle paths that are unreachable from their mnt_root") Suggested-by: Al Viro Signed-off-by: Aleksa Sarai Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/namei.c +++ b/fs/namei.c @@ -1370,7 +1370,7 @@ static int follow_dotdot_rcu(struct name nd->path.dentry = parent; nd->seq = seq; if (unlikely(!path_connected(&nd->path))) - return -ENOENT; + return -ECHILD; break; } else { struct mount *mnt = real_mount(nd->path.mnt);