netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain()
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Mon, 12 Sep 2022 13:58:51 +0000 (22:58 +0900)
committerFlorian Westphal <fw@strlen.de>
Tue, 20 Sep 2022 21:50:03 +0000 (23:50 +0200)
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.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 3bc158f8d0330f0a ("netfilter: nf_tables: map basechain priority to hardware priority")
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nf_tables_api.c

index e062754..63c7014 100644 (file)
@@ -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)