netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 Aug 2022 15:55:07 +0000 (17:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:40:23 +0000 (11:40 +0200)
commite58d1a96e93b5d8556ba087e1487365c8ca68eea
tree9de8b2bd30e2fb3dd55d51521d0d17ca56259c6f
parent7ac21b920ee6dd29574fc9fe58c8f1933e8864f6
netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified

commit 1b6345d4160ecd3d04bd8cd75df90c67811e8cc9 upstream.

Since f3a2181e16f1 ("netfilter: nf_tables: Support for sets with
multiple ranged fields"), it possible to combine intervals and
concatenations. Later on, ef516e8625dd ("netfilter: nf_tables:
reintroduce the NFT_SET_CONCAT flag") provides the NFT_SET_CONCAT flag
for userspace to report that the set stores a concatenation.

Make sure NFT_SET_CONCAT is set on if field_count is specified for
consistency. Otherwise, if NFT_SET_CONCAT is specified with no
field_count, bail out with EINVAL.

Fixes: ef516e8625dd ("netfilter: nf_tables: reintroduce the NFT_SET_CONCAT flag")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_tables_api.c