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 742382BB5 for ; Thu, 26 May 2016 15:32:52 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 26 May 2016 06:32:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,367,1459839600"; d="scan'208";a="815332189" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga003.jf.intel.com with ESMTP; 26 May 2016 06:32:50 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.38]) by IRSMSX103.ger.corp.intel.com ([169.254.3.198]) with mapi id 14.03.0248.002; Thu, 26 May 2016 14:32:50 +0100 From: "Pattan, Reshma" To: "dev@dpdk.org" Thread-Topic: [PATCH] drivers/net/pcap: fix segfault in pcap pmd Thread-Index: AQHRt1K1zZ0NXZbgUUqqUgk6/RKrxZ/LN1nA Date: Thu, 26 May 2016 13:32:48 +0000 Message-ID: <3AEA2BF9852C6F48A459DA490692831F010376D0@IRSMSX109.ger.corp.intel.com> References: <1464269389-24687-1-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1464269389-24687-1-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGQxMzIwMjAtZjY1MC00NjhkLThhODEtNmM2NzI3OTAzMDIzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InFLazFqRkpWVEU3T1JsTUpIaGdaTCtuQngrQ2hrNUoxY1FYM0hPUzVoOHM9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] drivers/net/pcap: fix segfault in pcap pmd 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, 26 May 2016 13:32:52 -0000 Self-Nacking.. wrong patch > -----Original Message----- > From: Pattan, Reshma > Sent: Thursday, May 26, 2016 2:30 PM > To: dev@dpdk.org > Cc: Pattan, Reshma > Subject: [PATCH] drivers/net/pcap: fix segfault in pcap pmd >=20 > Testpmd application will crash in fclose() upon quit after running the be= low > command. >=20 > "sudo gdb --args ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4 --= vdev > 'eth_pcap0,tx_iface=3Denp1s0f1,rx_pcap=3D/tmp/test.pcap' -- --port- > topology=3Dchained -i" >=20 > The reason is, pcap vdev creation with tx stream type as "iface" as in ab= ove > command dont need member ''dumpers'' of "struct tx_pcaps", hence will not > have memory allocated. But contains a garbage values, as local object of = struct > tx_pcaps is not initialized to 0 inside rte_pmd_pcap_dev_init(). So calli= ng > pcap_dump_close() on dumper as part of eth_dev_stop() is causing segfault= in > fclose(). >=20 > Fix is to initilize local object of struct tx_pcaps to 0. > Also initiliaze local object of stcruct rx_pcaps to 0. >=20 > So during eth_dev_stop(), pcap_dump_close() will not be called if dumper = is > NULL. >=20 > Fixes:4c173302("pcap: add new driver") >=20 > Signed-off-by: Reshma Pattan > --- > drivers/net/pcap/rte_eth_pcap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_p= cap.c > index c98e234..e0bb500 100644 > --- a/drivers/net/pcap/rte_eth_pcap.c > +++ b/drivers/net/pcap/rte_eth_pcap.c > @@ -978,8 +978,8 @@ rte_pmd_pcap_devinit(const char *name, const char > *params) > unsigned numa_node, using_dumpers =3D 0; > int ret; > struct rte_kvargs *kvlist; > - struct rx_pcaps pcaps; > - struct tx_pcaps dumpers; > + struct rx_pcaps pcaps=3D{0}; > + struct tx_pcaps dumpers=3D{0}; >=20 > RTE_LOG(INFO, PMD, "Initializing pmd_pcap for %s\n", name); >=20 > -- > 2.5.0