Skip to content

Commit 14e2dee

Browse files
Laura Garcia Liebanaummakynes
authored andcommitted
netfilter: nft_hash: fix hash overflow validation
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: 70ca767 ("netfilter: nft_hash: Add hash offset value") Reported-by: Liping Zhang <[email protected]> Signed-off-by: Laura Garcia Liebana <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2e917d6 commit 14e2dee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nft_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int nft_hash_init(const struct nft_ctx *ctx,
7676
if (priv->modulus <= 1)
7777
return -ERANGE;
7878

79-
if (priv->offset + priv->modulus - 1 < U32_MAX)
79+
if (priv->offset + priv->modulus - 1 < priv->offset)
8080
return -EOVERFLOW;
8181

8282
priv->seed = ntohl(nla_get_be32(tb[NFTA_HASH_SEED]));

0 commit comments

Comments
 (0)