From: Stephen Hemminger <stephen@networkplumber.org>
To: yongwang@vmware.com
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH] net/vmxnet3: handle bad host framing
Date: Tue, 12 May 2020 13:40:03 -0700 [thread overview]
Message-ID: <20200512204003.26686-1-stephen@networkplumber.org> (raw)
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
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
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
next reply other threads:[~2020-05-12 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-12 20:40 Stephen Hemminger [this message]
2020-05-13 22:24 ` Yong Wang
2020-05-14 16:15 ` Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200512204003.26686-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=yongwang@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).