Skip to contentSkip to conversation

net: fix inner L2 length in software ptype parser

PATCH Applied Olivier Matz 2 participants 2 messages Sep 11, 2017 – Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix inner L2 length in software ptype parser

The inner L2 length returned by rte_net_get_ptype() is not properly initialized. If the caller does not zero the header lengths structure, the inner_l2 field will be undefined.

Fix it by initializing inner_l2 to 0 when parsing a inner layer.

Fixes 2c15c5377da2 ("net: support NVGRE in software packet type parser")
---
 lib/librte_net/rte_net.c | 1 +
 1 file changed, 1 insertion(+)
lib/librte_net/rte_net.c +1 -0
index a8c7aff9c..a3ca04032 100644
@@ -396,6 +396,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 	if ((layers & RTE_PTYPE_INNER_L2_MASK) == 0)
 		return pkt_type;
 
+	hdr_lens->inner_l2_len = 0;
 	if (proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) {
 		eh = rte_pktmbuf_read(m, off, sizeof(*eh), &eh_copy);
 		if (unlikely(eh == NULL))
Signature · 1 line
2.11.0
#1 lore raw

11/09/2017 16:57, Olivier Matz:

Quoted 9 lines

The inner L2 length returned by rte_net_get_ptype() is not properly initialized. If the caller does not zero the header lengths structure, the inner_l2 field will be undefined.

Fix it by initializing inner_l2 to 0 when parsing a inner layer.

Fixes 2c15c5377da2 ("net: support NVGRE in software packet type parser")

Applied, thanks