[PATCH 2/5] net: check IPv6 extension header length is present

Stephen Hemminger stephen at networkplumber.org
Thu Nov 12 20:54:43 CET 2026


rte_net_skip_ip6_ext() trusts the length in each extension header.
An intermediate overrun is caught when the loop reads the next header,
but the last advance is never read, so the offset can end up past the
end of the packet. rte_net_get_ptype() then returns an l3_len and an
L4 packet type chosen by the sender.

Check the declared length against the packet length before advancing.

Bugzilla ID: 2120
Fixes: ab09e04d2c3f ("net: add function to get packet type from data")
Cc: stable at dpdk.org

Reported-by: Anthropic OSS scanner (ANT-2026-8BPC0WL7)
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/net/rte_net.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 07284fa97a..b6d5127fcd 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -305,6 +305,9 @@ rte_net_skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
 				&xh_copy);
 			if (xh == NULL)
 				return -1;
+			/* last advance is not covered by any later read */
+			if (*off + (xh->len + 1) * 8 > rte_pktmbuf_pkt_len(m))
+				return -1;
 			*off += (xh->len + 1) * 8;
 			proto = xh->next_hdr;
 			break;
@@ -313,6 +316,8 @@ rte_net_skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
 				&xh_copy);
 			if (xh == NULL)
 				return -1;
+			if (*off + 8 > rte_pktmbuf_pkt_len(m))
+				return -1;
 			*off += 8;
 			proto = xh->next_hdr;
 			*frag = 1;
-- 
2.53.0



More information about the stable mailing list