* [PATCH] netfilter: nft_hash: fix hash overflow validation
@ 2016-09-13 8:21 Laura Garcia Liebana
2016-09-13 8:48 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Laura Garcia Liebana @ 2016-09-13 8:21 UTC (permalink / raw)
To: netfilter-devel
The overflow validation in the init() function establishes that the
maximum value that the hash could reach is less than U32_MAX, which is
likely to be true.
The fix detects the overflow when the maximum hash value is less than
the offset itself.
Fixes: 70ca767ea1b2 ("netfilter: nft_hash: Add hash offset value")
Reported-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
---
net/netfilter/nft_hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index bd12f7a..09473b4 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -76,7 +76,7 @@ static int nft_hash_init(const struct nft_ctx *ctx,
if (priv->modulus <= 1)
return -ERANGE;
- if (priv->offset + priv->modulus - 1 < U32_MAX)
+ if (priv->offset + priv->modulus - 1 < priv->offset)
return -EOVERFLOW;
priv->seed = ntohl(nla_get_be32(tb[NFTA_HASH_SEED]));
--
2.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: nft_hash: fix hash overflow validation
2016-09-13 8:21 [PATCH] netfilter: nft_hash: fix hash overflow validation Laura Garcia Liebana
@ 2016-09-13 8:48 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-09-13 8:48 UTC (permalink / raw)
To: Laura Garcia Liebana; +Cc: netfilter-devel
On Tue, Sep 13, 2016 at 10:21:46AM +0200, Laura Garcia Liebana wrote:
> The overflow validation in the init() function establishes that the
> maximum value that the hash could reach is less than U32_MAX, which is
> likely to be true.
>
> The fix detects the overflow when the maximum hash value is less than
> the offset itself.
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-13 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 8:21 [PATCH] netfilter: nft_hash: fix hash overflow validation Laura Garcia Liebana
2016-09-13 8:48 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.