summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-11-24 13:04:37 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2022-11-28 13:17:11 +0100
commit97d4d394b58777f7056ebba8ffdb4002d0563259 (patch)
treeacfc92709decb19471ededde6a97ff97ff5e6e2f /net
parentf2fc2280faabafc8df83ee007699d21f7a6301fe (diff)
downloadlinux-stable-97d4d394b58777f7056ebba8ffdb4002d0563259.tar.gz
linux-stable-97d4d394b58777f7056ebba8ffdb4002d0563259.tar.bz2
linux-stable-97d4d394b58777f7056ebba8ffdb4002d0563259.zip
netfilter: nft_set_pipapo: Actually validate intervals in fields after the first one
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: 3c4287f62044 ("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>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_set_pipapo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 4f9299b9dcdd..06d46d182634 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -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;
u8 genmask = nft_genmask_next(net);
struct nft_pipapo_field *f;
+ const u8 *start_p, *end_p;
int i, bsize_max, err = 0;
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 */
+ start_p = start;
+ end_p = end;
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)
return -ENOSPC;