[lvc-project] [PATCH] netfilter: nft_set_pipapo: always drain gc list on commit

Denis Zubov d.zubov at tssltd.ru
Sat Sep 5 17:42:11 MSK 2026


A gc scan adds a transaction to the set's gc list, but that list is
only drained at the end of commit. When nothing needs updating, commit
returns early and skips the drain, leaving the entry behind. Destroying
the set then finds a non-empty gc list, warns, and panics under
panic_on_warn.

Fix it by guarding only the set swap with the early check and always
draining the gc list before returning.

Signed-off-by: Denis Zubov <d.zubov at tssltd.ru>
---
 net/netfilter/nft_set_pipapo.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 2c9247b24e96..765756f8d763 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -1850,16 +1850,15 @@ static void nft_pipapo_commit(struct nft_set *set)
 	if (time_after_eq(jiffies, priv->last_gc + nft_set_gc_interval(set)))
 		pipapo_gc_scan(set, priv->clone);
 
-	if (!priv->dirty)
-		return;
-
-	old = rcu_replace_pointer(priv->match, priv->clone,
-				  nft_pipapo_transaction_mutex_held(set));
-	priv->clone = NULL;
-	priv->dirty = false;
+	if (priv->dirty) {
+		old = rcu_replace_pointer(priv->match, priv->clone,
+					  nft_pipapo_transaction_mutex_held(set));
+		priv->clone = NULL;
+		priv->dirty = false;
 
-	if (old)
-		call_rcu(&old->rcu, pipapo_reclaim_match);
+		if (old)
+			call_rcu(&old->rcu, pipapo_reclaim_match);
+	}
 
 	pipapo_gc_queue(set);
 }
-- 
2.53.0




More information about the lvc-project mailing list