Skip to contentSkip to conversation

netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description

PATCH New Pablo Neira Ayuso 1 participant 1 message Jan 15, 2024

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description

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")
---
 net/netfilter/nf_tables_api.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +5 -1
index 9dec48b4398c..fcae0aa0482a 100644
@@ -5061,8 +5061,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;
 	}
Signature · 1 line
2.30.2