From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 026953B5 for ; Mon, 6 Oct 2014 16:28:07 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Xb9NT-0001C2-Ui; Mon, 06 Oct 2014 10:35:13 -0400 Date: Mon, 6 Oct 2014 10:35:06 -0400 From: Neil Horman To: =?iso-8859-1?Q?Nicol=E1s?= Pernas Maradei Message-ID: <20141006143506.GA22304@hmsreliant.think-freely.org> References: <1410380225-13751-1-git-send-email-nico@emutex.com> <20140929142406.GC26483@hmsreliant.think-freely.org> <7ab24cf8da0f11aa07b6770883de356a@statler.emutex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7ab24cf8da0f11aa07b6770883de356a@statler.emutex.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] Fix librte_pmd_pcap driver double stop error 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, 06 Oct 2014 14:28:07 -0000 On Sat, Oct 04, 2014 at 07:14:21PM +0100, Nicolás Pernas Maradei wrote: > Hi, > > You are correct, the parameters received in the driver are allocated in > devargs_list (char *params variable). However, they already get strdup'd in > rte_kvargs_parse(). This newly allocated string is part of kvlist and never > freed up. The params variable is never used again so it can be freed by > someone else using free_devargs_list(). I'd say it's safe enough to set up > pointers in the way it's currently done. > > Nico. > ok, that seems reasonable Acked-by: Neil Horman > On 2014-09-29 15:24, Neil Horman wrote: > >On Wed, Sep 10, 2014 at 05:17:05PM -0300, Nicolás Pernas Maradei wrote: > >>From: Nicolás Pernas Maradei > >> > >>librte_pmd_pcap driver was opening the pcap/interfaces only at init time > >>and > >>closing them only when the port was being stopped. This behaviour would > >>cause > >>problems (leading to segfault) if the user closed the port 2 times. The > >>first > >>time the pcap/interfaces would be normally closed but libpcap would > >>throw an > >>error causing a segfault if the closed pcaps/interfaces were closed > >>again. > >>This behaviour is solved by re-openning pcaps/interfaces when the port > >>is > >>started (only if these weren't open already for example at init time). > >> > >>Signed-off-by: Nicolás Pernas Maradei > > > >This patch assigns pointers to strings that are allocated in the > >devargs_list. > >Given that there exists an api interface free_devargs_list(), I'm not sure > >that > >whats being done here is consistently safe. It seems like you should dup > >the > >strings to make sure you always have the storage allocated, or find some > >other > >method to store the needed information. > > > >Neil >