* [dpdk-dev] [RFT] vmxnet3: coverity reported defect
@ 2018-04-05 15:36 Stephen Hemminger
2018-04-05 16:47 ` Ferruh Yigit
2018-04-06 11:18 ` Neil Horman
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-04-05 15:36 UTC (permalink / raw)
To: ferruh.yigit; +Cc: dev
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.
diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 57557492e0f5..3118d94add90 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -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 <skhare@vmware.com> bounces.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [RFT] vmxnet3: coverity reported defect
2018-04-05 15:36 [dpdk-dev] [RFT] vmxnet3: coverity reported defect Stephen Hemminger
@ 2018-04-05 16:47 ` Ferruh Yigit
2018-04-06 11:18 ` Neil Horman
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-04-05 16:47 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Yong Wang
On 4/5/2018 4:36 PM, Stephen Hemminger wrote:
> 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.
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index 57557492e0f5..3118d94add90 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -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 <skhare@vmware.com> bounces.
Yong Wang send a patch [1] to take over vmxnet3 maintainership.
[1]
https://dpdk.org/dev/patchwork/patch/36795/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [RFT] vmxnet3: coverity reported defect
2018-04-05 15:36 [dpdk-dev] [RFT] vmxnet3: coverity reported defect Stephen Hemminger
2018-04-05 16:47 ` Ferruh Yigit
@ 2018-04-06 11:18 ` Neil Horman
1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2018-04-06 11:18 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: ferruh.yigit, dev
On Thu, Apr 05, 2018 at 08:36:18AM -0700, Stephen Hemminger wrote:
> 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.
>
> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> index 57557492e0f5..3118d94add90 100644
> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
> @@ -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++;
>
This looks reasonable to me, though my vmware instance is down at the moment, so
I'm unable to test
>
> PS: the email for the VMXNET3 maintainer Shrikrishna Khare <skhare@vmware.com> bounces.
>
I think it needs to be updated to point at pv-drivers@vmware.com, thats what
they use in the kernel these days
Neil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-06 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 15:36 [dpdk-dev] [RFT] vmxnet3: coverity reported defect Stephen Hemminger
2018-04-05 16:47 ` Ferruh Yigit
2018-04-06 11:18 ` Neil Horman
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).