netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netdev@vger.kernel.org
Cc: <netfilter-devel@vger.kernel.org>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net 13/17] netfilter: nf_tables: disallow NFT_SET_ELEM_CATCHALL and NFT_SET_ELEM_INTERVAL_END
Date: Wed, 17 Aug 2022 16:00:11 +0200	[thread overview]
Message-ID: <20220817140015.25843-14-fw@strlen.de> (raw)
In-Reply-To: <20220817140015.25843-1-fw@strlen.de>

From: Pablo Neira Ayuso <pablo@netfilter.org>

These flags are mutually exclusive, report EINVAL in this case.

Fixes: aaa31047a6d2 ("netfilter: nftables: add catch-all set element support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 1d14d694f654..b1b12e083abb 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5198,6 +5198,9 @@ static int nft_setelem_parse_flags(const struct nft_set *set,
 	if (!(set->flags & NFT_SET_INTERVAL) &&
 	    *flags & NFT_SET_ELEM_INTERVAL_END)
 		return -EINVAL;
+	if ((*flags & (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL)) ==
+	    (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL))
+		return -EINVAL;
 
 	return 0;
 }
-- 
2.35.1


  parent reply	other threads:[~2022-08-17 14:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 13:59 [PATCH net 00/17] netfilter: conntrack and nf_tables bug fixes Florian Westphal
2022-08-17 13:59 ` [PATCH net 01/17] netfilter: nf_tables: use READ_ONCE and WRITE_ONCE for shared generation id access Florian Westphal
2022-08-18  5:00   ` patchwork-bot+netdevbpf
2022-08-17 14:00 ` [PATCH net 02/17] netfilter: nf_tables: disallow NFTA_SET_ELEM_KEY_END with NFT_SET_ELEM_INTERVAL_END flag Florian Westphal
2022-08-17 14:00 ` [PATCH net 03/17] netfilter: nf_tables: possible module reference underflow in error path Florian Westphal
2022-08-17 14:00 ` [PATCH net 04/17] netfilter: nf_ct_sane: remove pseudo skb linearization Florian Westphal
2022-08-17 14:00 ` [PATCH net 05/17] netfilter: nf_ct_h323: cap packet size at 64k Florian Westphal
2022-08-17 14:00 ` [PATCH net 06/17] netfilter: nf_ct_ftp: prefer skb_linearize Florian Westphal
2022-08-17 14:00 ` [PATCH net 07/17] netfilter: nf_ct_irc: cap packet search space to 4k Florian Westphal
2022-08-17 14:00 ` [PATCH net 08/17] netfilter: nf_tables: fix scheduling-while-atomic splat Florian Westphal
2022-08-17 14:00 ` [PATCH net 09/17] netfilter: nfnetlink: re-enable conntrack expectation events Florian Westphal
2022-08-17 14:00 ` [PATCH net 10/17] netfilter: nf_tables: really skip inactive sets when allocating name Florian Westphal
2022-08-17 14:00 ` [PATCH net 11/17] netfilter: nf_tables: validate NFTA_SET_ELEM_OBJREF based on NFT_SET_OBJECT flag Florian Westphal
2022-08-17 14:00 ` [PATCH net 12/17] netfilter: nf_tables: NFTA_SET_ELEM_KEY_END requires concat and interval flags Florian Westphal
2022-08-17 14:00 ` Florian Westphal [this message]
2022-08-17 14:00 ` [PATCH net 14/17] netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified Florian Westphal
2022-08-17 14:00 ` [PATCH net 15/17] netfilter: conntrack: NF_CONNTRACK_PROCFS should no longer default to y Florian Westphal
2022-08-17 14:00 ` [PATCH net 16/17] testing: selftests: nft_flowtable.sh: use random netns names Florian Westphal
2022-08-17 14:00 ` [PATCH net 17/17] testing: selftests: nft_flowtable.sh: rework test to detect offload failure Florian Westphal

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=20220817140015.25843-14-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).