diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-10-28 15:07:06 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-11-04 18:31:17 +0100 |
commit | de2a60522343a6cab998f61fd906eae445b19963 (patch) | |
tree | 7371b190093334ef0c9475a51281e0138b6fe5e4 /net/netfilter/nft_bitwise.c | |
parent | 1204c70d9dcba31164f78ad5d8c88c42335d51f8 (diff) | |
download | linux-de2a60522343a6cab998f61fd906eae445b19963.tar.gz linux-de2a60522343a6cab998f61fd906eae445b19963.tar.bz2 linux-de2a60522343a6cab998f61fd906eae445b19963.zip |
netfilter: nf_tables_offload: check for register data length mismatches
Make sure register data length does not mismatch immediate data length,
otherwise hit EOPNOTSUPP.
Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_bitwise.c')
-rw-r--r-- | net/netfilter/nft_bitwise.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/netfilter/nft_bitwise.c b/net/netfilter/nft_bitwise.c index 974300178fa9..02afa752dd2e 100644 --- a/net/netfilter/nft_bitwise.c +++ b/net/netfilter/nft_bitwise.c @@ -134,12 +134,13 @@ static int nft_bitwise_offload(struct nft_offload_ctx *ctx, const struct nft_expr *expr) { const struct nft_bitwise *priv = nft_expr_priv(expr); + struct nft_offload_reg *reg = &ctx->regs[priv->dreg]; if (memcmp(&priv->xor, &zero, sizeof(priv->xor)) || - priv->sreg != priv->dreg) + priv->sreg != priv->dreg || priv->len != reg->len) return -EOPNOTSUPP; - memcpy(&ctx->regs[priv->dreg].mask, &priv->mask, sizeof(priv->mask)); + memcpy(®->mask, &priv->mask, sizeof(priv->mask)); return 0; } |