All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de
Subject: [PATCH net 12/13] netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description
Date: Thu, 18 Jan 2024 17:17:25 +0100	[thread overview]
Message-ID: <20240118161726.14838-13-pablo@netfilter.org> (raw)
In-Reply-To: <20240118161726.14838-1-pablo@netfilter.org>

It is still possible to set on the NFT_SET_CONCAT flag by specifying a
set size and no field description, report EINVAL in such case.

Fixes: 1b6345d4160e ("netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 88a6a858383b..4b55533ce5ca 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5070,8 +5070,12 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info,
 		if (err < 0)
 			return err;
 
-		if (desc.field_count > 1 && !(flags & NFT_SET_CONCAT))
+		if (desc.field_count > 1) {
+			if (!(flags & NFT_SET_CONCAT))
+				return -EINVAL;
+		} else if (flags & NFT_SET_CONCAT) {
 			return -EINVAL;
+		}
 	} else if (flags & NFT_SET_CONCAT) {
 		return -EINVAL;
 	}
-- 
2.30.2


  parent reply	other threads:[~2024-01-18 16:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 16:17 [PATCH net,v2 00/13] Netfilter fixes for net Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 01/13] netfilter: nf_tables: reject invalid set policy Pablo Neira Ayuso
2024-01-18 21:10   ` patchwork-bot+netdevbpf
2024-01-18 16:17 ` [PATCH net 02/13] netfilter: nf_tables: validate .maxattr at expression registration Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 03/13] netfilter: nf_tables: bail out if stateful expression provides no .clone Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 04/13] netfilter: nft_limit: do not ignore unsupported flags Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 05/13] netfilter: nfnetlink_log: use proper helper for fetching physinif Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 06/13] netfilter: nf_queue: remove excess nf_bridge variable Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 07/13] netfilter: propagate net to nf_bridge_get_physindev Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 08/13] netfilter: bridge: replace physindev with physinif in nf_bridge_info Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 09/13] netfilter: nf_tables: check if catch-all set element is active in next generation Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 10/13] netfilter: nf_tables: do not allow mismatch field size and set key length Pablo Neira Ayuso
2024-01-18 16:17 ` [PATCH net 11/13] netfilter: nf_tables: skip dead set elements in netlink dump Pablo Neira Ayuso
2024-01-18 16:17 ` Pablo Neira Ayuso [this message]
2024-01-18 16:17 ` [PATCH net 13/13] ipvs: avoid stat macros calls from preemptible context 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=20240118161726.14838-13-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.