pcap: fix Tx mbuf corruption
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Wed, 28 May 2014 14:47:02 +0000 (15:47 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 10 Jun 2014 11:23:35 +0000 (13:23 +0200)
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>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
lib/librte_pmd_pcap/rte_eth_pcap.c

index dc4670c..6a411a9 100644 (file)
@@ -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);
        }