From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.digiweb.ie (smtp2.digiweb.ie [83.147.160.14]) by dpdk.org (Postfix) with ESMTP id 7CE62212 for ; Sat, 4 Oct 2014 20:07:24 +0200 (CEST) Received: from statler.emutex.com (unknown [92.51.199.138]) by smtp.digiweb.ie (Postfix) with ESMTP id 46EAE290037; Sat, 4 Oct 2014 19:14:23 +0100 (IST) Received: from [91.103.1.99] (helo=www.emutex.com) by statler.emutex.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1XaTqZ-0006Mg-6L; Sat, 04 Oct 2014 19:14:23 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Sat, 04 Oct 2014 19:14:21 +0100 From: =?UTF-8?Q?Nicol=C3=A1s_Pernas_Maradei?= To: Neil Horman Organization: Emutex Mail-Reply-To: nico@emutex.com In-Reply-To: <20140929142406.GC26483@hmsreliant.think-freely.org> References: <1410380225-13751-1-git-send-email-nico@emutex.com> <20140929142406.GC26483@hmsreliant.think-freely.org> Message-ID: <7ab24cf8da0f11aa07b6770883de356a@statler.emutex.com> X-Sender: nico@emutex.com User-Agent: Roundcube Webmail/RCMAIL_VERSION Cc: dev@dpdk.org Subject: Re: [dpdk-dev] =?utf-8?q?=5BPATCH=5D_Fix_librte=5Fpmd=5Fpcap_driver_d?= =?utf-8?q?ouble_stop_error?= X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: nico@emutex.com List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Oct 2014 18:07:24 -0000 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. 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