]> git.itanic.dy.fi Git - linux-stable/commitdiff
netfilter: nf_tables: allow loop termination for pending fatal signal
authorFlorian Westphal <fw@strlen.de>
Wed, 21 Jun 2023 08:36:26 +0000 (10:36 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 22 Aug 2023 13:14:32 +0000 (15:14 +0200)
abort early so task can exit faster if a fatal signal is pending,
no need to continue validation in that case.

Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nf_tables_api.c

index 3e841e45f2c07e6f3a8105aa7c167ffae760015a..f00a1dff85e802b34851792728eee00299368705 100644 (file)
@@ -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;
 
@@ -10479,6 +10482,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;