Skip to contentSkip to conversation

netfilter: nft_cmp: check for register data length mismatches

PATCH New Pablo Neira Ayuso 1 participant 1 message Oct 28, 2019

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nft_cmp: check for register data length mismatches

Make sure register data length does not mismatch data length in the comparison, otherwise hit EOPNOTSUPP.

Fixes c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
---
 net/netfilter/nft_cmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_cmp.c +1 -1
index bd173b1824c6..0744b2bb46da 100644
@@ -116,7 +116,7 @@ static int __nft_cmp_offload(struct nft_offload_ctx *ctx,
 	u8 *mask = (u8 *)&flow->match.mask;
 	u8 *key = (u8 *)&flow->match.key;
 
-	if (priv->op != NFT_CMP_EQ)
+	if (priv->op != NFT_CMP_EQ || reg->len != priv->len)
 		return -EOPNOTSUPP;
 
 	memcpy(key + reg->offset, &priv->data, priv->len);
Signature · 1 line
2.11.0