Skip to contentSkip to conversation

net/vmxnet3: handle bad host framing

PATCH Applied Stephen Hemminger 3 participants 3 messages May 12, 2020 – May 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/vmxnet3: handle bad host framing

The VMXNet3 protocol has a start-of-packet (SOP) and end-of-packet (EOP) marker. If there was a bug where mbuf arrived without SOP the code that chains the mbuf would dereference a null pointer.
Also, record any mbuf's dropped in statistics.

Although did the initial code no longer have access to VMware. Compile tested only!

Coverity issue: 124563

---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +5 -1
index dd99684bee4d..73e270f30f00 100644
@@ -950,13 +950,17 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 			RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
 
-			if (rxm->data_len) {
+			if (likely(start && rxm->data_len > 0)) {
 				start->pkt_len += rxm->data_len;
 				start->nb_segs++;
 
 				rxq->last_seg->next = rxm;
 				rxq->last_seg = rxm;
 			} else {
+				PMD_RX_LOG(ERR, "Error received empty or out of order frame.");
+				rxq->stats.drop_total++;
+				rxq->stats.drop_err++;
+
 				rte_pktmbuf_free_seg(rxm);
 			}
 		}
Signature · 1 line
2.20.1
#1 lore raw

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Date: Tuesday, May 12, 2020 at 1:40 PM
To: Yong Wang <[email protected]>
Cc: "[email protected]" <[email protected]>, Stephen Hemminger <[email protected]>
Subject: [PATCH] net/vmxnet3: handle bad host framing

The VMXNet3 protocol has a start-of-packet (SOP) and end-of-packet (EOP) marker. If there was a bug where mbuf arrived without SOP the code that chains the mbuf would dereference a null pointer.
Also, record any mbuf's dropped in statistics.

Although did the initial code no longer have access to VMware. Compile tested only!

Coverity issue: 124563

---

<Acked-by> Yong Wang <[email protected]>

     drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
    index dd99684bee4d..73e270f30f00 100644
    --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
    +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
    @@ -950,13 +950,17 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)

     			RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);

    -			if (rxm->data_len) {
    +			if (likely(start && rxm->data_len > 0)) {
     				start->pkt_len += rxm->data_len;
     				start->nb_segs++;

     				rxq->last_seg->next = rxm;
     				rxq->last_seg = rxm;
     			} else {
    +				PMD_RX_LOG(ERR, "Error received empty or out of order frame.");
    +				rxq->stats.drop_total++;
    +				rxq->stats.drop_err++;
    +
     				rte_pktmbuf_free_seg(rxm);
     			}
     		}
    -- 
    2.20.1
Applied
#2 lore raw
Quoted 12 lines · Yong Wang

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Date: Tuesday, May 12, 2020 at 1:40 PM
To: Yong Wang <[email protected]>
Cc: "[email protected]" <[email protected]>, Stephen Hemminger <[email protected]>
Subject: [PATCH] net/vmxnet3: handle bad host framing

The VMXNet3 protocol has a start-of-packet (SOP) and end-of-packet (EOP) marker. If there was a bug where mbuf arrived without SOP the code that chains the mbuf would dereference a null pointer.
Also, record any mbuf's dropped in statistics.

Quoted 8 lines

Although did the initial code no longer have access to VMware. Compile tested only!

Coverity issue: 124563

---

<Acked-by> Yong Wang <[email protected]>

Applied to dpdk-next-net/master, thanks.