From: Neil Horman Subject: Re: [PATCH] Fix librte_pmd_pcap driver double stop error Date: Mon, 6 Oct 2014 10:35:06 -0400 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-Transfer-Encoding: quoted-printable Cc: dev-VfR2kkLFssw@public.gmane.org To: =?iso-8859-1?Q?Nicol=E1s?= Pernas Maradei Return-path: Content-Disposition: inline In-Reply-To: <7ab24cf8da0f11aa07b6770883de356a-Cc/FPSX6RAUzc0FSMupyHtBPR1lH4CV8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Sat, Oct 04, 2014 at 07:14:21PM +0100, Nicol=E1s Pernas Maradei wrote: > Hi, >=20 > 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 n= ever > 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. >=20 > Nico. >=20 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=E1s Pernas Maradei wro= te: > >>From: Nicol=E1s Pernas Maradei > >> > >>librte_pmd_pcap driver was opening the pcap/interfaces only at init t= ime > >>and > >>closing them only when the port was being stopped. This behaviour wou= ld > >>cause > >>problems (leading to segfault) if the user closed the port 2 times. T= he > >>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 por= t > >>is > >>started (only if these weren't open already for example at init time)= . > >> > >>Signed-off-by: Nicol=E1s 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 so= me > >other > >method to store the needed information. > > > >Neil >=20