netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf 1/2] netfilter: nft_exthdr: check for IPv6 packet before further processing
@ 2021-06-10 18:20 Pablo Neira Ayuso
  2021-06-10 18:20 ` [PATCH nf 2/2] netfilter: nft_osf: check for TCP " Pablo Neira Ayuso
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2021-06-10 18:20 UTC (permalink / raw)
  To: netfilter-devel

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>
---
 net/netfilter/nft_exthdr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c
index 7f705b5c09de..d8f03175879f 100644
--- a/net/netfilter/nft_exthdr.c
+++ b/net/netfilter/nft_exthdr.c
@@ -44,6 +44,9 @@ static void nft_exthdr_ipv6_eval(const struct nft_expr *expr,
 	unsigned int offset = 0;
 	int err;
 
+	if (skb->protocol != htons(ETH_P_IPV6))
+		goto err;
+
 	err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
 	if (priv->flags & NFT_EXTHDR_F_PRESENT) {
 		nft_reg_store8(dest, err >= 0);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-16 14:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-10 18:20 [PATCH nf 1/2] netfilter: nft_exthdr: check for IPv6 packet before further processing Pablo Neira Ayuso
2021-06-10 18:20 ` [PATCH nf 2/2] netfilter: nft_osf: check for TCP " Pablo Neira Ayuso
2021-06-16 14:42   ` kernel test robot
2021-06-16 12:48 ` [PATCH nf 1/2] netfilter: nft_exthdr: check for IPv6 " kernel test robot
2021-06-16 13:48 ` kernel test robot
2021-06-16 14:14 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).