Skip to contentSkip to conversation

netfilter: nf_tables: skip deactivation of deleted rules in bound chain

PATCH New Pablo Neira Ayuso 1 participant 1 message Sep 6, 2023

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: skip deactivation of deleted rules in bound chain

Rules can still be deleted from unbound chains. Mark them as deleted in the next generation so they are not reachable anymore. Skip deleted rules when this (now) bound chain is removed.

Fixes 0a771f7b266b ("netfilter: nf_tables: skip immediate deactivate in _PREPARE_ERROR")
---
 net/netfilter/nft_immediate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/netfilter/nft_immediate.c +6 -1
index fccb3cf7749c..d6d1d94532eb 100644
@@ -135,8 +135,13 @@ static void nft_immediate_chain_deactivate(const struct nft_ctx *ctx,
 	chain_ctx = *ctx;
 	chain_ctx.chain = chain;
 
-	list_for_each_entry(rule, &chain->rules, list)
+	list_for_each_entry(rule, &chain->rules, list) {
+		if (!nft_is_active_next(ctx->net, rule))
+			continue;
+
+		nft_deactivate_next(ctx->net, rule);
 		nft_rule_expr_deactivate(&chain_ctx, rule, phase);
+	}
 }
 
 static void nft_immediate_deactivate(const struct nft_ctx *ctx,
Signature · 1 line
2.30.2