mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
netfilter: nf_tables: bail out on mismatching dynset and set expressions
[ Upstream commit 3701cd390fd731ee7ae8b8006246c8db82c72bea ]
If dynset expressions provided by userspace is larger than the declared
set expressions, then bail out.
Fixes: 48b0ae046e ("netfilter: nftables: netlink support for several set element expressions")
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
219c6b5584
commit
cf5f113c41
@@ -279,10 +279,15 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
|
|||||||
priv->expr_array[i] = dynset_expr;
|
priv->expr_array[i] = dynset_expr;
|
||||||
priv->num_exprs++;
|
priv->num_exprs++;
|
||||||
|
|
||||||
if (set->num_exprs &&
|
if (set->num_exprs) {
|
||||||
dynset_expr->ops != set->exprs[i]->ops) {
|
if (i >= set->num_exprs) {
|
||||||
err = -EOPNOTSUPP;
|
err = -EINVAL;
|
||||||
goto err_expr_free;
|
goto err_expr_free;
|
||||||
|
}
|
||||||
|
if (dynset_expr->ops != set->exprs[i]->ops) {
|
||||||
|
err = -EOPNOTSUPP;
|
||||||
|
goto err_expr_free;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user