[dpdk-dev] [PATCH] Fix librte_pmd_pcap driver double stop error

Nicolás Pernas Maradei nico at emutex.com
Sat Oct 4 20:14:21 CEST 2014


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 <nico at emutex.com>
>> 
>> 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 <nico at emutex.com>
> 
> 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


More information about the dev mailing list