mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-11 20:05:22 +02:00
netfilter: nft_inner: validate mandatory meta and payload
[ Upstream commitc4ab9da85b
] Check for mandatory netlink attributes in payload and meta expression when used embedded from the inner expression, otherwise NULL pointer dereference is possible from userspace. Fixes:a150d122b6
("netfilter: nft_meta: add inner match support") Fixes:3a07327d10
("netfilter: nft_inner: support for inner tunnel header matching") Signed-off-by: Davide Ornaghi <d.ornaghi97@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7ccca396e9
commit
b30669fdea
|
@ -839,6 +839,9 @@ static int nft_meta_inner_init(const struct nft_ctx *ctx,
|
||||||
struct nft_meta *priv = nft_expr_priv(expr);
|
struct nft_meta *priv = nft_expr_priv(expr);
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
||||||
|
if (!tb[NFTA_META_KEY] || !tb[NFTA_META_DREG])
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
priv->key = ntohl(nla_get_be32(tb[NFTA_META_KEY]));
|
priv->key = ntohl(nla_get_be32(tb[NFTA_META_KEY]));
|
||||||
switch (priv->key) {
|
switch (priv->key) {
|
||||||
case NFT_META_PROTOCOL:
|
case NFT_META_PROTOCOL:
|
||||||
|
|
|
@ -650,6 +650,10 @@ static int nft_payload_inner_init(const struct nft_ctx *ctx,
|
||||||
struct nft_payload *priv = nft_expr_priv(expr);
|
struct nft_payload *priv = nft_expr_priv(expr);
|
||||||
u32 base;
|
u32 base;
|
||||||
|
|
||||||
|
if (!tb[NFTA_PAYLOAD_BASE] || !tb[NFTA_PAYLOAD_OFFSET] ||
|
||||||
|
!tb[NFTA_PAYLOAD_LEN] || !tb[NFTA_PAYLOAD_DREG])
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
base = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_BASE]));
|
base = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_BASE]));
|
||||||
switch (base) {
|
switch (base) {
|
||||||
case NFT_PAYLOAD_TUN_HEADER:
|
case NFT_PAYLOAD_TUN_HEADER:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user