netfilter: nft_exthdr: check for IPv6 packet before further processing
[ Upstream commit cdd73cc545c0fb9b1a1f7b209f4f536e7990cff4 ] ipv6_find_hdr() does not validate that this is an IPv6 packet. Add a sanity check for calling ipv6_find_hdr() to make sure an IPv6 packet is passed for parsing. Fixes: 96518518cc41 ("netfilter: add nftables") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
37c723fb14
commit
f5623bd84f
@ -34,6 +34,9 @@ static void nft_exthdr_eval(const struct nft_expr *expr,
|
||||
unsigned int offset = 0;
|
||||
int err;
|
||||
|
||||
if (pkt->skb->protocol != htons(ETH_P_IPV6))
|
||||
goto err;
|
||||
|
||||
err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
|
||||
if (err < 0)
|
||||
goto err;
|
||||
|
Loading…
x
Reference in New Issue
Block a user