From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
Date: Wed, 28 May 2014 15:47:02 +0100 [thread overview]
Message-ID: <1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com> (raw)
If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
mbuf and continue.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
lib/librte_pmd_pcap/rte_eth_pcap.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index dc4670c..6f026ab 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -239,8 +239,9 @@ eth_pcap_tx(void *queue,
mbuf = bufs[i];
ret = pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf->pkt.data,
mbuf->pkt.data_len);
- if(likely(!ret))
- num_tx++;
+ if (unlikely(ret != 0))
+ break;
+ num_tx++;
rte_pktmbuf_free(mbuf);
}
--
1.7.7.6
next reply other threads:[~2014-05-28 14:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 14:47 Konstantin Ananyev [this message]
2014-06-05 15:33 ` De Lara Guarch, Pablo
2014-06-06 3:33 ` Cao, Waterman
2014-06-10 11:25 ` Thomas Monjalon
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=1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com \
--to=konstantin.ananyev@intel.com \
--cc=dev@dpdk.org \
/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).