netfilter: nf_tables: sanitize nft_set_desc_concat_parse()
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 27 May 2022 07:56:18 +0000 (09:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 06:43:38 +0000 (08:43 +0200)
commit89ef50fe03a55feccf5681c237673a2f98161161
tree58d28d6ff66e396665b4204a41cd4aba1a0464ca
parente61717947af57fd6751e1e79d4179f561dfc6149
netfilter: nf_tables: sanitize nft_set_desc_concat_parse()

commit fecf31ee395b0295f2d7260aa29946b7605f7c85 upstream.

Add several sanity checks for nft_set_desc_concat_parse():

- validate desc->field_count not larger than desc->field_len array.
- field length cannot be larger than desc->field_len (ie. U8_MAX)
- total length of the concatenation cannot be larger than register array.

Joint work with Florian Westphal.

Fixes: f3a2181e16f1 ("netfilter: nf_tables: Support for sets with multiple ranged fields")
Reported-by: <zhangziming.zzm@antgroup.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_tables_api.c