From: Konstantin Ananyev Date: Wed, 28 May 2014 14:47:02 +0000 (+0100) Subject: pcap: fix Tx mbuf corruption X-Git-Tag: spdx-start~10771 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=88523f27e8448fc45c531e58a53af49cce39e891;p=dpdk.git 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 --- 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); }