diff mbox series

[net,1/3] netfilter: nft_set_pipapo: release elements in clone only from destroy path

Message ID 20240321112117.36737-2-pablo@netfilter.org (mailing list archive)
State Accepted
Commit b0e256f3dd2ba6532f37c5c22e07cb07a36031ee
Delegated to: Netdev Maintainers
Headers show
Series [net,1/3] netfilter: nft_set_pipapo: release elements in clone only from destroy path | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 939 this patch: 939
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 1 blamed authors not CCed: sbrivio@redhat.com; 4 maintainers not CCed: coreteam@netfilter.org sbrivio@redhat.com fw@strlen.de kadlec@netfilter.org
netdev/build_clang success Errors and warnings before: 956 this patch: 956
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-21--12-00 (tests: 908)

Commit Message

Pablo Neira Ayuso March 21, 2024, 11:21 a.m. UTC
Clone already always provides a current view of the lookup table, use it
to destroy the set, otherwise it is possible to destroy elements twice.

This fix requires:

 212ed75dc5fb ("netfilter: nf_tables: integrate pipapo into commit protocol")

which came after:

 9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path").

Fixes: 9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_set_pipapo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 21, 2024, 2:20 p.m. UTC | #1
Hello:

This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <pablo@netfilter.org>:

On Thu, 21 Mar 2024 12:21:15 +0100 you wrote:
> Clone already always provides a current view of the lookup table, use it
> to destroy the set, otherwise it is possible to destroy elements twice.
> 
> This fix requires:
> 
>  212ed75dc5fb ("netfilter: nf_tables: integrate pipapo into commit protocol")
> 
> [...]

Here is the summary with links:
  - [net,1/3] netfilter: nft_set_pipapo: release elements in clone only from destroy path
    https://git.kernel.org/netdev/net/c/b0e256f3dd2b
  - [net,2/3] netfilter: nf_tables: do not compare internal table flags on updates
    https://git.kernel.org/netdev/net/c/4a0e7f2decbf
  - [net,3/3] netfilter: nf_tables: Fix a memory leak in nf_tables_updchain
    https://git.kernel.org/netdev/net/c/7eaf837a4eb5

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index c0ceea068936..df8de5090246 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -2329,8 +2329,6 @@  static void nft_pipapo_destroy(const struct nft_ctx *ctx,
 	if (m) {
 		rcu_barrier();
 
-		nft_set_pipapo_match_destroy(ctx, set, m);
-
 		for_each_possible_cpu(cpu)
 			pipapo_free_scratch(m, cpu);
 		free_percpu(m->scratch);
@@ -2342,8 +2340,7 @@  static void nft_pipapo_destroy(const struct nft_ctx *ctx,
 	if (priv->clone) {
 		m = priv->clone;
 
-		if (priv->dirty)
-			nft_set_pipapo_match_destroy(ctx, set, m);
+		nft_set_pipapo_match_destroy(ctx, set, m);
 
 		for_each_possible_cpu(cpu)
 			pipapo_free_scratch(priv->clone, cpu);