From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id A7872475E for ; Mon, 13 Jun 2016 13:07:57 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 13 Jun 2016 04:07:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,466,1459839600"; d="scan'208";a="974493359" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.220.58]) by orsmga001.jf.intel.com with SMTP; 13 Jun 2016 04:07:54 -0700 Received: by (sSMTP sendmail emulation); Mon, 13 Jun 2016 12:07:54 +0025 Date: Mon, 13 Jun 2016 12:07:54 +0100 From: Bruce Richardson To: Reshma Pattan Cc: dev@dpdk.org Message-ID: <20160613110754.GG13464@bricha3-MOBL3> References: <1464269755-26123-1-git-send-email-reshma.pattan@intel.com> <1464350780-724-1-git-send-email-reshma.pattan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1464350780-724-1-git-send-email-reshma.pattan@intel.com> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2] 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: Mon, 13 Jun 2016 11:07:58 -0000 On Fri, May 27, 2016 at 01:06:20PM +0100, Reshma Pattan wrote: > Testpmd application will crash in fclose() upon quit after running > the below command. > > "sudo gdb --args ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf0 -n 4 > --vdev 'eth_pcap0,tx_iface=enp1s0f1,rx_pcap=/tmp/test.pcap' -- > --port-topology=chained -i" > > The reason is, pcap vdev creation with tx stream type as "iface" > as in above command don't 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 calling pcap_dump_close() on dumper as part of eth_dev_stop() > is causing segfault in fclose(). > > Fix is to initialize local object of struct tx_pcaps to 0. > Also initialize local object of struct rx_pcaps to 0. > > So during eth_dev_stop(), pcap_dump_close() will not be called if dumper > is NULL. > > Fixes:4c173302("pcap: add new driver") > > Signed-off-by: Reshma Pattan > Acked-by: Ferruh Yigit > --- > v2: > Fixed typos in commit message. > Fixed commit message line length to 75. > Fixed subject line of the patch. The subject line is still not the best, since the prefix is "pcap" having the subject also finish with "in pcap pmd" is superfluous. I've fixed the title to "pcap: fix segfault on close" on apply. > --- > drivers/net/pcap/rte_eth_pcap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Applied to dpdk_next_net/rel_16_07 /Bruce