public inbox for netfilter-devel@vger.kernel.org
 help / color / mirror / Atom feed
From: Fernando Fernandez Mancera <fmancera@suse.de>
To: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Cc: Hyunwoo Kim <imv4bel@gmail.com>
Subject: Re: [PATCH nf] netfilter: nf_tables: reject requests exceeding NF_FLOW_RULE_ACTION_MAX actions
Date: Thu, 26 Mar 2026 13:03:32 +0100	[thread overview]
Message-ID: <d33c0d7f-e281-4371-964d-3ecfc647f5e1@suse.de> (raw)
In-Reply-To: <20260325164130.29060-1-fw@strlen.de>

On 3/25/26 5:41 PM, Florian Westphal wrote:
> nf_flow_offload_rule_alloc() allocates space for NF_FLOW_RULE_ACTION_MAX
> entries.  Make sure userspace passes more entries to us.
> 

nit: shouldn't this be "Make sure userspace does not pass more entries 
to us"?

Other than that, LGTM.

Thanks.

> Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>   Can also route via nf-next if thats deemed the better tree.
> 
>   include/net/netfilter/nf_flow_table.h | 2 ++
>   net/netfilter/nf_flow_table_offload.c | 2 --
>   net/netfilter/nf_tables_offload.c     | 5 +++--
>   3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
> index b09c11c048d5..0b2fb1467b3f 100644
> --- a/include/net/netfilter/nf_flow_table.h
> +++ b/include/net/netfilter/nf_flow_table.h
> @@ -13,6 +13,8 @@
>   #include <linux/if_pppox.h>
>   #include <linux/ppp_defs.h>
>   
> +#define NF_FLOW_RULE_ACTION_MAX	16
> +
>   struct nf_flowtable;
>   struct nf_flow_rule;
>   struct flow_offload;
> diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
> index 9b677e116487..11463682bbfa 100644
> --- a/net/netfilter/nf_flow_table_offload.c
> +++ b/net/netfilter/nf_flow_table_offload.c
> @@ -727,8 +727,6 @@ int nf_flow_rule_route_ipv6(struct net *net, struct flow_offload *flow,
>   }
>   EXPORT_SYMBOL_GPL(nf_flow_rule_route_ipv6);
>   
> -#define NF_FLOW_RULE_ACTION_MAX	16
> -
>   static struct nf_flow_rule *
>   nf_flow_offload_rule_alloc(struct net *net,
>   			   const struct flow_offload_work *offload,
> diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c
> index 9101b1703b52..a2f7966bc201 100644
> --- a/net/netfilter/nf_tables_offload.c
> +++ b/net/netfilter/nf_tables_offload.c
> @@ -88,10 +88,11 @@ static void nft_flow_rule_transfer_vlan(struct nft_offload_ctx *ctx,
>   struct nft_flow_rule *nft_flow_rule_create(struct net *net,
>   					   const struct nft_rule *rule)
>   {
> +	unsigned int num_actions = 0;
>   	struct nft_offload_ctx *ctx;
>   	struct nft_flow_rule *flow;
> -	int num_actions = 0, err;
>   	struct nft_expr *expr;
> +	int err;
>   
>   	expr = nft_expr_first(rule);
>   	while (nft_expr_more(rule, expr)) {
> @@ -102,7 +103,7 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net,
>   		expr = nft_expr_next(expr);
>   	}
>   
> -	if (num_actions == 0)
> +	if (num_actions == 0 || num_actions > NF_FLOW_RULE_ACTION_MAX)
>   		return ERR_PTR(-EOPNOTSUPP);
>   
>   	flow = nft_flow_rule_alloc(num_actions);


  reply	other threads:[~2026-03-26 12:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 16:41 [PATCH nf] netfilter: nf_tables: reject requests exceeding NF_FLOW_RULE_ACTION_MAX actions Florian Westphal
2026-03-26 12:03 ` Fernando Fernandez Mancera [this message]
2026-03-26 21:49 ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d33c0d7f-e281-4371-964d-3ecfc647f5e1@suse.de \
    --to=fmancera@suse.de \
    --cc=fw@strlen.de \
    --cc=imv4bel@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox