From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by dpdk.org (Postfix) with ESMTP id 25BBCB10E for ; Wed, 28 May 2014 16:47:51 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 28 May 2014 07:47:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,928,1392192000"; d="scan'208";a="438079439" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 28 May 2014 07:47:10 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s4SEl9wO018638; Wed, 28 May 2014 15:47:09 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s4SEl91a010865; Wed, 28 May 2014 15:47:09 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id s4SEl9cS010861; Wed, 28 May 2014 15:47:09 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Wed, 28 May 2014 15:47:02 +0100 Message-Id: <1401288422-10449-1-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.0.7 To: dev@dpdk.org Subject: [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: Wed, 28 May 2014 14:47:52 -0000 If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that mbuf and continue. Signed-off-by: Konstantin Ananyev --- 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