From 88523f27e8448fc45c531e58a53af49cce39e891 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Wed, 28 May 2014 15:47:02 +0100 Subject: [PATCH] pcap: fix Tx mbuf corruption If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that mbuf and continue. Signed-off-by: Konstantin Ananyev Acked-by: Pablo de Lara Guarch Tested-by: Waterman Cao --- lib/librte_pmd_pcap/rte_eth_pcap.c | 5 +++-- 1 file 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 dc4670c14c..6a411a9340 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); } -- 2.20.1