From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 374163F9 for ; Thu, 5 Jun 2014 17:33:26 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 05 Jun 2014 08:33:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,981,1392192000"; d="scan'208";a="542968464" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga001.fm.intel.com with ESMTP; 05 Jun 2014 08:33:28 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.58]) by IRSMSX102.ger.corp.intel.com ([169.254.2.105]) with mapi id 14.03.0123.003; Thu, 5 Jun 2014 16:33:25 +0100 From: "De Lara Guarch, Pablo" To: "Ananyev, Konstantin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption Thread-Index: AQHPeoPrjUuisgvdfkeDYLSHMiL43ZtiselA Date: Thu, 5 Jun 2014 15:33:25 +0000 Message-ID: References: <1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com> In-Reply-To: <1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corruption X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2014 15:33:26 -0000 Acked-by: Pablo de Lara Guarch > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Konstantin Ananyev > Sent: Wednesday, May 28, 2014 3:47 PM > To: dev@dpdk.org; dev@dpdk.org > Subject: [dpdk-dev] [PATCH] fix for eth_pcap_tx() can cause mbuf corrupti= on >=20 > If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that > mbuf and continue. >=20 > Signed-off-by: Konstantin Ananyev > --- > lib/librte_pmd_pcap/rte_eth_pcap.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) >=20 > 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 =3D bufs[i]; > ret =3D pcap_sendpacket(tx_queue->pcap, (u_char*) mbuf- > >pkt.data, > mbuf->pkt.data_len); > - if(likely(!ret)) > - num_tx++; > + if (unlikely(ret !=3D 0)) > + break; > + num_tx++; > rte_pktmbuf_free(mbuf); > } >=20 > -- > 1.7.7.6