From: Pablo Neira Ayuso Date: Mon, 15 Jan 2024 11:50:29 +0000 (+0100) Subject: netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description X-Git-Tag: v6.6.14~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf6b3b6d110f5e333bf402c13456d7da476af9c1;p=thirdparty%2Fkernel%2Fstable.git netfilter: nf_tables: reject NFT_SET_CONCAT with not field length description [ Upstream commit 113661e07460a6604aacc8ae1b23695a89e7d4b3 ] 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 Signed-off-by: Sasha Levin --- diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 1f6d5ffbe34a8..b28fbcb86e949 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5010,8 +5010,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; }