From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE810C6FA82 for ; Mon, 12 Sep 2022 14:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbiILORq (ORCPT ); Mon, 12 Sep 2022 10:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230130AbiILORm (ORCPT ); Mon, 12 Sep 2022 10:17:42 -0400 Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78A8D32AA8; Mon, 12 Sep 2022 07:17:38 -0700 (PDT) Date: Mon, 12 Sep 2022 16:17:34 +0200 From: Pablo Neira Ayuso To: Tetsuo Handa Cc: Jozsef Kadlecsik , Florian Westphal , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Network Development Subject: Re: [PATCH] netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain() Message-ID: References: <41e415f2-3ca4-8e8a-a4b5-5044e7043131@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <41e415f2-3ca4-8e8a-a4b5-5044e7043131@I-love.SAKURA.ne.jp> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Sep 12, 2022 at 10:58:51PM +0900, Tetsuo Handa wrote: > It seems to me that percpu memory for chain stats started leaking since > commit 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to > hardware priority") when nft_chain_offload_priority() returned an error. Patch also LGTM. Thanks. > Signed-off-by: Tetsuo Handa > Fixes: 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to hardware priority") > --- > The "netfilter: nf_tables: fix nft_counters_enabled underflow at nf_tables_addchain()" made > me wonder where free_percpu() is called when nft_basechain_init() returned an error. But I > don't know whether this patch is correct. Please check carefully. > > net/netfilter/nf_tables_api.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c > index e062754dc6cc..63c70141b3e5 100644 > --- a/net/netfilter/nf_tables_api.c > +++ b/net/netfilter/nf_tables_api.c > @@ -2243,6 +2243,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask, > if (err < 0) { > nft_chain_release_hook(&hook); > kfree(basechain); > + free_percpu(stats); > return err; > } > if (stats) > -- > 2.18.4