Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B10FDC433DB for ; Tue, 30 Mar 2021 08:44:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79F7460249 for ; Tue, 30 Mar 2021 08:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbhC3Iny (ORCPT ); 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 >