[dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Thu Jun 5 17:33:25 CEST 2014


Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch at intel.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Konstantin Ananyev
> Sent: Wednesday, May 28, 2014 3:47 PM
> To: dev at dpdk.org; dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption
> 
> If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
> mbuf and continue.
> 
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev at 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



More information about the dev mailing list