You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
netfilter: nft_set_pipapo: Actually validate intervals in fields after the first one
[ Upstream commit97d4d394b5] Embarrassingly, nft_pipapo_insert() checked for interval validity in the first field only. The start_p and end_p pointers were reset to key data from the first field at every iteration of the loop which was supposed to go over the set fields. Fixes:3c4287f620("nf_tables: Add set type for arbitrary concatenation of ranges") Reported-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cb283cca1d
commit
a0418d0a6b
@@ -1162,6 +1162,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
|
|||||||
struct nft_pipapo_match *m = priv->clone;
|
struct nft_pipapo_match *m = priv->clone;
|
||||||
u8 genmask = nft_genmask_next(net);
|
u8 genmask = nft_genmask_next(net);
|
||||||
struct nft_pipapo_field *f;
|
struct nft_pipapo_field *f;
|
||||||
|
const u8 *start_p, *end_p;
|
||||||
int i, bsize_max, err = 0;
|
int i, bsize_max, err = 0;
|
||||||
|
|
||||||
if (nft_set_ext_exists(ext, NFT_SET_EXT_KEY_END))
|
if (nft_set_ext_exists(ext, NFT_SET_EXT_KEY_END))
|
||||||
@@ -1202,9 +1203,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Validate */
|
/* Validate */
|
||||||
|
start_p = start;
|
||||||
|
end_p = end;
|
||||||
nft_pipapo_for_each_field(f, i, m) {
|
nft_pipapo_for_each_field(f, i, m) {
|
||||||
const u8 *start_p = start, *end_p = end;
|
|
||||||
|
|
||||||
if (f->rules >= (unsigned long)NFT_PIPAPO_RULE0_MAX)
|
if (f->rules >= (unsigned long)NFT_PIPAPO_RULE0_MAX)
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user