Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp406504ybi; Thu, 11 Jul 2019 21:51:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqoLR8TLVgYm1xoFSV4J5bRsvz+s6CauMeAEcw6zpkmkdBtdaRlZ4jMwZybvQeyctErmcS X-Received: by 2002:a17:902:204:: with SMTP id 4mr8806747plc.178.1562907119024; Thu, 11 Jul 2019 21:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562907119; cv=none; d=google.com; s=arc-20160816; b=z5MYe5HB6NgbjWWNllSMCL/yvC+RwyfB6+9YhHuzVCnNvUWa30aLP052AZ7R4avS44 4iHEVICStzaksPkXYo1SpWgzKMdQhkcBZaLDv7TZABs4u2tbGtcmon3xzO9VjJsQYOga whtFenHMBqv4PH+VI9qjMHMgNKeNFDf8OmDNxIzhX/gEpekSKrm1vKWJkqaY46RDUrTL ERd2ZiqzeNRLwdPW+skFlNSiQxlm2tz0pj8DzWXOckVD3xy3kj43iBq7igw8LwL/CR6s vV/SrTRRgP0cPRFzPIFYBVvzS0HHRIlpBg8ICKKDHSqWdh0xIDtnZgC0a9R/1A0/TUo4 tgew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5vyTx2MOaIQ75fHpnW55s9OJvDaXdUSeHigsG0Yq9Ks=; b=HCofpFnEcTlOUtTGU6A5LoUqy7ikBYFTLS8tCNLhij/gaz8gOv0rxUxnAonmHu93/R 1AZe+Klolbt+3FGcLFNu4l/DGxDss8dVks0QNVPEbO+5vjm26/xMxA7+av3C5yqUJ4m0 Nrh1FZ3xcUwaoWiDjYlaNISk6N4xqVUA8OXQDV0FC1gryQ5llcKL3po+9sIRT51bS3+P DN3INaMuXHjGpUGS7fSK1UAFHwUSkG00+FGR5YGsg76TeKGoZv7463Igu+DH4tX5LH4G ohx5327c5/4rcpYJ5eTaW+X4ELRxrwt7rgEOkQ3QiOMinZ1JK7Ccw0z8HrCxseKVkE+b Cr3Q== 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 j62si7337744pgd.170.2019.07.11.21.51.43; Thu, 11 Jul 2019 21:51:59 -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; 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 S1729388AbfGLEVS (ORCPT + 99 others); Fri, 12 Jul 2019 00:21:18 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:60178 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbfGLEVR (ORCPT ); Fri, 12 Jul 2019 00:21:17 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hln3C-0003A0-92; Fri, 12 Jul 2019 04:20:50 +0000 Date: Fri, 12 Jul 2019 05:20:50 +0100 From: Al Viro To: Aleksa Sarai Cc: Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Christian Brauner , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Aleksa Sarai , Linus Torvalds , containers@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v9 04/10] namei: split out nd->dfd handling to dirfd_path_init Message-ID: <20190712042050.GH17978@ZenIV.linux.org.uk> References: <20190706145737.5299-1-cyphar@cyphar.com> <20190706145737.5299-5-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190706145737.5299-5-cyphar@cyphar.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 07, 2019 at 12:57:31AM +1000, Aleksa Sarai wrote: > Previously, path_init's handling of *at(dfd, ...) was only done once, > but with LOOKUP_BENEATH (and LOOKUP_IN_ROOT) we have to parse the > initial nd->path at different times (before or after absolute path > handling) depending on whether we have been asked to scope resolution > within a root. > if (*s == '/') { > - set_root(nd); > - if (likely(!nd_jump_root(nd))) > - return s; > - return ERR_PTR(-ECHILD); > + if (likely(!nd->root.mnt)) > + set_root(nd); How can we get there with non-NULL nd->root.mnt, when LOOKUP_ROOT case has been already handled by that point? > + error = nd_jump_root(nd); > + if (unlikely(error)) > + s = ERR_PTR(error);