Received: by 2002:a05:622a:1442:b0:3a5:28ea:c4b9 with SMTP id v2csp549359qtx; Thu, 3 Nov 2022 06:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FuxtGwx62ispv7i7/3hMKobgVDxh9oYSK2RCVDgHtTvPdMTAaRAMGcvbrCtCgngJR9tv6 X-Received: by 2002:a17:907:7ea0:b0:7ad:ef1e:3bc6 with SMTP id qb32-20020a1709077ea000b007adef1e3bc6mr12887189ejc.690.1667482942164; Thu, 03 Nov 2022 06:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667482942; cv=none; d=google.com; s=arc-20160816; b=qJCaFfWcS4qImWijtUTIPIdZLQoGEPJ4T8ND27njwfDdBKqYOUJn/AB2qb7QkRQhc9 mLZbo3H2poyKYJkCIZbsKWTM/tII4l7EnmzPHhxe90QaG8h7F8rvMtgYT223WRafgp/0 cAJqN7oBrmPZJlIoOtu620sd+fRCkpDCXJfF/c2sXUaRvfO/nozBuGcYjwcWzH2jziJL F9PTaRI/nTbPMbFMHgkq4zSF3EUQGBIBX3+z36XKwD6lHfMCaDQfglCBYm1KbKtZo1mq vpiLgiyRMT2hSd0BBGWVlh6stbiLO/7X5nHGrr+3/udn+h7hIRLEhJIgq0wXzdxTna/2 NEBQ== 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; bh=go9B5E1R8jkcVT0FNHzWnuNOA0MND/Ah9iFJwwClCcA=; b=xRJJffswONBMPDZIAcP5zXEfecpEe3r2/M0Jt0iKcEkJpM4AYHe3cv3PfiDImAZXRL fjUTkqJokIwMlRE31bPlOjPpbkgKJPlNWIs6tr5ojSo6UeC5NzDeuhis2FFQ5Ymplcuf E3jNqdk0NCwqqo3PvRzHwII0j7SlI/QyVv0BGvMPOMVHn7hNBdfI9BYG/HOoDGLdLX46 D3LSdVnPm5Oww4+JiNsOftef82Yh2p8UWSO7qiWJnibLH+DGewmngpy+HWoZmUN0LsQV sRLLPjREcBxGpPColMqK0rUgO33dFESoOp6oeIM5QoFiwIG2CCVvapfyLS65yoJW6WFt N8/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw30-20020a1709066a1e00b0077b2e822b5dsi1633385ejc.674.2022.11.03.06.41.55; Thu, 03 Nov 2022 06:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbiKCNSk (ORCPT + 98 others); Thu, 3 Nov 2022 09:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbiKCNSe (ORCPT ); Thu, 3 Nov 2022 09:18:34 -0400 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D9DF1B3; Thu, 3 Nov 2022 06:18:32 -0700 (PDT) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1oqa73-0002Y7-2M; Thu, 03 Nov 2022 14:18:29 +0100 Date: Thu, 3 Nov 2022 14:18:29 +0100 From: Florian Westphal To: Shigeru Yoshida Cc: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+178efee9e2d7f87f5103@syzkaller.appspotmail.com Subject: Re: [PATCH] netfilter: Cleanup nft_net->module_list from nf_tables_exit_net() Message-ID: <20221103131829.GB29268@breakpoint.cc> References: <20221103130849.1624522-1-syoshida@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103130849.1624522-1-syoshida@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Shigeru Yoshida wrote: > syzbot reported a warning like below [1]: > > This patch fixes this issue by calling __nf_tables_abort() when > nft_net->module_list is not empty in nf_tables_exit_net(). Fixes: eb014de4fd41 ("netfilter: nf_tables: autoload modules from the abort path") > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c > index 58d9cbc9ccdc..a7579d16f59f 100644 > --- a/net/netfilter/nf_tables_api.c > +++ b/net/netfilter/nf_tables_api.c > @@ -10088,7 +10088,8 @@ static void __net_exit nf_tables_exit_net(struct net *net) > struct nftables_pernet *nft_net = nft_pernet(net); > > mutex_lock(&nft_net->commit_mutex); > - if (!list_empty(&nft_net->commit_list)) > + if (!list_empty(&nft_net->commit_list) || > + !list_empty(&nft_net->module_list)) > __nf_tables_abort(net, NFNL_ABORT_NONE); Maybe just an unconditionall call to nf_tables_module_autoload_cleanup(). Or, alternatively, unconditionally call __nf_tables_abort(). The downside is that we will need to change __nf_tables_abort to elide synchronize_rcu() unless needed -- else netns dismantling might become too expensive. OTOH, module_list should always be empty here, so this is ok. Reviewed-by: Florian Westphal