Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4203363pxf; Tue, 30 Mar 2021 01:45:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7JxXh0sQ4rdtfN2pwZL68NEmCmKJIlbbOi9jFUzeTnVfaQS0d1F6VvP94ClsVu1/TrTBj X-Received: by 2002:a17:906:7194:: with SMTP id h20mr32144867ejk.154.1617093901055; Tue, 30 Mar 2021 01:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617093901; cv=none; d=google.com; s=arc-20160816; b=Av4ZgrzsriI30WbNmIceT71FcikPhWvwET5B/vXVnAA2A1qYNN1T0v0oSUZpZ2ksPv mTOUNwS54lHhpKhnbCGohRwZFTta5zIlCVSNh3dmtb77IYJLrUET+xODixyYqJvIV5CT fiVEyJg4fG+SbPxx0sxazUi9N2bUa09oyb/WC/6qS1N7l4G1XpsAnjVI3JJLlFzX2JIA 6brFU2RMwMnVSOV+pTiUkyp9IgGj6hCcJjIlb70ly8wB5mBo74G6Z2ingpme7Q6Srwx0 G1SUKUiA/rSFJzHp51GMRv6FlI+agxoCixPeIotfFf4gQX4Ahg+moA13tbV37EQZhs5u 5y0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OeWyaOOOtgQZIyx4uAlvkwAUVRaJ84FWOw7eqtiQhcs=; b=itQCl6VD54JMEqPOAY8KkT5AfJWaIzePKeFmHTkwgodjFV239AH7V2rFFtBHnl3WNq UG2KFZ/HkeJ75SkfHYMLmQkLonfh9eOWMxj0pqrDgHmejdSGpd6K99dZnYj856xvtlmP LDPearOx1LgCCqe756ziAFYFpCnImNf22Rh8vYuuJGECn1xnQKv62HTB/B2iam3Eylnn eROTPBCn7DIQyhnM+6/WF+rifO++2J5fag1iMzlcroEw13l0in/oSUQ/dUeDaW6ZnG/c 0Jfgef5koNK70xJSH4tcfaN3zDXZ/39fz/DGrGPCWieff4gfS2X6+dHuLzmjADjlZq/b P5pA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si15216274ejy.363.2021.03.30.01.44.28; Tue, 30 Mar 2021 01:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbhC3Iny (ORCPT + 99 others); Tue, 30 Mar 2021 04:43:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30948 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbhC3Ins (ORCPT ); Tue, 30 Mar 2021 04:43:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-LgDxU002M_WsYx2CqLDouQ-1; Tue, 30 Mar 2021 04:43:29 -0400 X-MC-Unique: LgDxU002M_WsYx2CqLDouQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF48980732F for ; Tue, 30 Mar 2021 08:43:28 +0000 (UTC) Received: from yoyang-pc.usersys.redhat.com (unknown [10.66.61.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E3F21001281; Tue, 30 Mar 2021 08:43:27 +0000 (UTC) Date: Tue, 30 Mar 2021 16:43:23 +0800 From: Yongcheng Yang To: steved@redhat.com Cc: Roberto Bergantinos Corpas , linux-nfs@vger.kernel.org Subject: Re: [PATCH] exportfs: make root unexportable Message-ID: <20210330084323.GA4033@yoyang-pc.usersys.redhat.com> References: <20210329105435.17431-1-rbergant@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329105435.17431-1-rbergant@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi SteveD, This is a real problem introduced by my previous update. Sorry for it. How about also adding this tag: Fixes: a9a7728d (exportfs: Deal with path's trailing "/" in unexportfs_parsed()) Thanks, Yongcheng On Mon, Mar 29, 2021 at 12:54:35PM +0200, Roberto Bergantinos Corpas wrote: > If root of the filesystem is exported, it cannot be explicitly > unexported, since unexportfs_parsed, in order to deal with trailing > '/', will leave nlen at 0 for root exported case > > Signed-off-by: Roberto Bergantinos Corpas > --- > utils/exportfs/exportfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c > index 9fcae0b3..9b6f4f5a 100644 > --- a/utils/exportfs/exportfs.c > +++ b/utils/exportfs/exportfs.c > @@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose) > * so need to deal with it. > */ > size_t nlen = strlen(path); > - while (path[nlen - 1] == '/') > + while ((path[nlen - 1] == '/') && (nlen > 1)) > nlen--; > > for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) { > -- > 2.21.0 >