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 DE1D42E8A for ; Tue, 5 Aug 2014 12:16:02 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 05 Aug 2014 03:18:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,804,1400050800"; d="scan'208";a="465093047" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 05 Aug 2014 03:18:22 -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 s75AILrH013735; Tue, 5 Aug 2014 11:18:22 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s75AILJO009797; Tue, 5 Aug 2014 11:18:21 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id s75AILYN009793; Tue, 5 Aug 2014 11:18:21 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Tue, 5 Aug 2014 11:18:20 +0100 Message-Id: <1407233900-9734-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function 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: Tue, 05 Aug 2014 10:16:03 -0000 Normally, bufs[i] stores the mbuf pointer, the index of buf[i] is the loop count i, but if header.len > buf_size, DPDK will free the mbuf, but the loop count i still increases, so some of the items in bufs[] might be NULL ponter, causing a potential DPDK core. Using num_rx as the index for bufs[] solves the problem. Signed-off-by: Pablo de Lara --- lib/librte_pmd_pcap/rte_eth_pcap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c index c77ee25..eebe768 100644 --- a/lib/librte_pmd_pcap/rte_eth_pcap.c +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c @@ -154,7 +154,7 @@ eth_pcap_rx(void *queue, rte_memcpy(mbuf->pkt.data, packet, header.len); mbuf->pkt.data_len = (uint16_t)header.len; mbuf->pkt.pkt_len = mbuf->pkt.data_len; - bufs[i] = mbuf; + bufs[num_rx] = mbuf; num_rx++; } else { /* pcap packet will not fit in the mbuf, so drop packet */ -- 1.7.0.7