Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp344684pxb; Thu, 30 Sep 2021 07:18:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNo7fBPGsmOjW5ts/zs+2pog69r4YXV1FjrXxT4ax1nJSWrbm5/aJyyht8cSAVcP/4rfah X-Received: by 2002:a63:bf07:: with SMTP id v7mr5069663pgf.475.1633011486264; Thu, 30 Sep 2021 07:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633011486; cv=none; d=google.com; s=arc-20160816; b=0A8iGzZVbgBSkSGP7EOB7JAtX7FHWxcy0uyfjtIdyW8qJoM7SjSimepPHB3VVHCPIE PFUhse5gHhBYv0iEKgb6N+NUHtaixlQSCQ/lIvAW6ESyecayxQtK4bGc0jmI6OQdNwT3 ceNTqdBTjE535/XPkl51zrdCnSIcuQrCYBYYUFVDSQ8GxqH8JhnrKOeziBQYQMfwiXTg JQkLmGvAAo4FMYVAC7Wzt4OuknoydxppTERwtUNXY3mTQx6kPCJUhBTT5/cjAUfc52eb bQt3ngXobb11wPsSU535Q8iy1d0nHlWbybNQq88D+8yLjdPfWOXnawdg3fmzIs7Me6p6 toCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=d+zTKb1U2WCtpOSHtjtEGCRkMq8DHSFqEIy3a/LI1Dg=; b=CqNUrHi3+iTn2VX7jRnKxxxKvi30aYx0d6PWlCJuZWDXgYo3lKGwWYwsgYT6hihOc/ OTntGYfQLEkiD2lEiL8oWfzYjsVsBkh4GGzoTsxgX+tLQHMTMHSl1dSWxbCDKrtpM3JH 7J46tBE4tT7Gjld3KAxFe/I7P80WFZB03ZYufw/UJq51o6AZhcYeEmjmixmZTmTO2rQZ rcnXDt4Xti4xF+pgs33PRt2G7G0Mg9E4rdg42eMukVUzJFiSGugBODPUvTd49O1Yls7W 8fFZGVM179s04Kn7p+s1w+YRxhQWnor9WYGy6bJCMbPTHF6hUEVCU8+0AYO54FK7K1ri keaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=XXmkX3d5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si6377548pju.8.2021.09.30.07.17.14; Thu, 30 Sep 2021 07:18:06 -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; dkim=pass header.i=@fieldses.org header.s=default header.b=XXmkX3d5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351837AbhI3OSE (ORCPT + 99 others); Thu, 30 Sep 2021 10:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240149AbhI3OSE (ORCPT ); Thu, 30 Sep 2021 10:18:04 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97018C06176A; Thu, 30 Sep 2021 07:16:21 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id BB434703F; Thu, 30 Sep 2021 10:16:20 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org BB434703F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1633011380; bh=d+zTKb1U2WCtpOSHtjtEGCRkMq8DHSFqEIy3a/LI1Dg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XXmkX3d58WdggHN44Xy7qNKKfXsKmNHyNMvAAPA2YwcCJioKbVi4kGKwpMhnz/Fom HHTj+Y056Rsqk6sfgEFNHAy33Y9XbGQYPkNOjDtp3qgXi2VXh5KDXGZ+LwWR7CvwZx yQ55umNNVGHORlMHWXZ363pgwhycuzpc+yVZGbig= Date: Thu, 30 Sep 2021 10:16:20 -0400 From: "J. Bruce Fields" To: "Ho, Patrick" Cc: Chuck Lever , "linux-nfs@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] nfsd: fix error handling of register_pernet_subsys() in init_nfsd() Message-ID: <20210930141620.GA9422@fieldses.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, Sep 30, 2021 at 03:48:42AM +0000, Ho, Patrick wrote: > >From 7417896fcc7aea645fa0b89f39fa55979251dca3 Mon Sep 17 00:00:00 2001 > From: Patrick Ho > Date: Sat, 21 Aug 2021 02:56:26 -0400 > Subject: [PATCH] nfsd: fix error handling of register_pernet_subsys() in > init_nfsd() > > init_nfsd() should not unregister pernet subsys if the register fails > but should instead unwind from the last successful operation which is > register_filesystem(). > > Unregistering a failed register_pernet_subsys() call can result in > a kernel GPF as revealed by programmatically injecting an error in > register_pernet_subsys(). > > Verified the fix handled failure gracefully with no lingering nfsd > entry in /proc/filesystems. This change was introduced by the commit > bd5ae9288d64 ("nfsd: register pernet ops last, unregister first"), > the original error handling logic was correct. Whoops, thanks for catching this. I assume Chuck will pick it up. Acked-by: J. Bruce Fields --b. > > Fixes: bd5ae9288d64 ("nfsd: register pernet ops last, unregister first") > Cc: stable@vger.kernel.org > Signed-off-by: Patrick Ho > --- > fs/nfsd/nfsctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > index c2c3d9077dc5..09ae1a0873d0 100644 > --- a/fs/nfsd/nfsctl.c > +++ b/fs/nfsd/nfsctl.c > @@ -1545,7 +1545,7 @@ static int __init init_nfsd(void) > goto out_free_all; > return 0; > out_free_all: > - unregister_pernet_subsys(&nfsd_net_ops); > + unregister_filesystem(&nfsd_fs_type); > out_free_exports: > remove_proc_entry("fs/nfs/exports", NULL); > remove_proc_entry("fs/nfs", NULL); > -- > 2.17.1