Skip to contentSkip to conversation

vmxnet3: coverity reported defect

RFT Stephen Hemminger 3 participants 3 messages Apr 5, 2018 – Apr 6, 2018

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

I noticed Coverity defect in DPDK number 124563 was assigned to me.

It looks like vmxnet3 driver code doesn't handle case where host incorrectly sends a frame with out setting SOP bit in first segment. This would lead to rxq->start_seq being NULL.

Maybe something like this would fix it. I don't have VMware (or time) to test.

drivers/net/vmxnet3/vmxnet3_rxtx.c +7 -0
index 57557492e0f5..3118d94add90 100644
@@ -813,6 +813,13 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 			RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
 
+			if (unlikely(start == NULL)) {
+				PMD_RX_LOG(ERR, "Missing sop");
+
+				rte_pktmbuf_free_seg(rxm);
+				goto rcd_done;
+			}
+
 			start->pkt_len += rxm->data_len;
 			start->nb_segs++;
 

PS: the email for the VMXNET3 maintainer Shrikrishna Khare <[email protected]> bounces.

#1 lore raw
Quoted 27 lines · Stephen Hemminger

I noticed Coverity defect in DPDK number 124563 was assigned to me.

It looks like vmxnet3 driver code doesn't handle case where host incorrectly sends a frame with out setting SOP bit in first segment. This would lead to rxq->start_seq being NULL.

Maybe something like this would fix it. I don't have VMware (or time) to test.

drivers/net/vmxnet3/vmxnet3_rxtx.c +7 -0
index 57557492e0f5..3118d94add90 100644
@@ -813,6 +813,13 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 			RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
 
+			if (unlikely(start == NULL)) {
+				PMD_RX_LOG(ERR, "Missing sop");
+
+				rte_pktmbuf_free_seg(rxm);
+				goto rcd_done;
+			}
+
 			start->pkt_len += rxm->data_len;
 			start->nb_segs++;
 
Quoted 1 line

PS: the email for the VMXNET3 maintainer Shrikrishna Khare <[email protected]> bounces.

Yong Wang send a patch [1] to take over vmxnet3 maintainership.

[1]
https://dpdk.org/dev/patchwork/patch/36795/

#2 lore raw
In reply to Stephen Hemminger
Quoted 16 lines · Stephen Hemminger

I noticed Coverity defect in DPDK number 124563 was assigned to me.

It looks like vmxnet3 driver code doesn't handle case where host incorrectly sends a frame with out setting SOP bit in first segment. This would lead to rxq->start_seq being NULL.

Maybe something like this would fix it. I don't have VMware (or time) to test.

drivers/net/vmxnet3/vmxnet3_rxtx.c +0 -0
index 57557492e0f5..3118d94add90 100644
@@ -813,6 +813,13 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 			RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY);
 

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) · line 825

Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_rxtx.c +7 -0
+			if (unlikely(start == NULL)) {
+				PMD_RX_LOG(ERR, "Missing sop");
+
+				rte_pktmbuf_free_seg(rxm);
+				goto rcd_done;
+			}
+
 			start->pkt_len += rxm->data_len;
 			start->nb_segs++;
 

This looks reasonable to me, though my vmware instance is down at the moment, so I'm unable to test

Quoted 3 lines

PS: the email for the VMXNET3 maintainer Shrikrishna Khare <[email protected]> bounces.

I think it needs to be updated to point at [email protected], thats what they use in the kernel these days

Neil