Skip to contentSkip to conversation

netfilter: nf_tables: allow loop termination for pending fatal signal

PATCH New Florian Westphal 1 participant 1 message Aug 21, 2023

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: allow loop termination for pending fatal signal

abort early so task can exit faster if a fatal signal is pending, no need to continue validation in that case.

---
 net/netfilter/nf_tables_api.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/netfilter/nf_tables_api.c +6 -0
index c62227ae7746..271c643f055f 100644
@@ -3675,6 +3675,9 @@ int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain)
 		return -EMLINK;
 
 	list_for_each_entry(rule, &chain->rules, list) {
+		if (fatal_signal_pending(current))
+			return -EINTR;
+
 		if (!nft_is_active_next(ctx->net, rule))
 			continue;
 
@@ -10459,6 +10462,9 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
 	if (ctx->chain == chain)
 		return -ELOOP;
 
+	if (fatal_signal_pending(current))
+		return -EINTR;
+
 	list_for_each_entry(rule, &chain->rules, list) {
 		nft_rule_for_each_expr(expr, last, rule) {
 			struct nft_immediate_expr *priv;
Signature · 1 line
2.41.0