From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4E494B38F for ; Tue, 12 Aug 2014 04:27:01 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 11 Aug 2014 19:29:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,846,1400050800"; d="scan'208";a="557180612" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 11 Aug 2014 19:29:52 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 11 Aug 2014 19:29:51 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 11 Aug 2014 19:29:51 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.17]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0195.001; Tue, 12 Aug 2014 10:29:49 +0800 From: "Jiajia, SunX" To: "De Lara Guarch, Pablo" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function Thread-Index: AQHPsJak0Vx3aFI/LUewbRSTO9XIJJvMRvUw Date: Tue, 12 Aug 2014 02:29:48 +0000 Message-ID: References: <1407233900-9734-1-git-send-email-pablo.de.lara.guarch@intel.com> In-Reply-To: <1407233900-9734-1-git-send-email-pablo.de.lara.guarch@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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, 12 Aug 2014 02:27:01 -0000 Tested-by: Jiajia SunX This patch fixed a bug by changing eth_pcap_rx function, and is ready to in= tegrate into DPDK.org. > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara > Sent: Tuesday, August 05, 2014 6:18 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] pcap: Fixed bug in eth_pcap_rx function >=20 > 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. >=20 > Signed-off-by: Pablo de Lara > --- > lib/librte_pmd_pcap/rte_eth_pcap.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) >=20 > 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 =3D (uint16_t)header.len; > mbuf->pkt.pkt_len =3D mbuf->pkt.data_len; > - bufs[i] =3D mbuf; > + bufs[num_rx] =3D mbuf; > num_rx++; > } else { > /* pcap packet will not fit in the mbuf, so drop > packet */ > -- > 1.7.0.7