DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Nicolás Pernas Maradei" <nico@emutex.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] Fix librte_pmd_pcap driver double stop error
Date: Sat, 04 Oct 2014 19:14:21 +0100	[thread overview]
Message-ID: <7ab24cf8da0f11aa07b6770883de356a@statler.emutex.com> (raw)
In-Reply-To: <20140929142406.GC26483@hmsreliant.think-freely.org>

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@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@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

  reply	other threads:[~2014-10-04 18:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 20:17 Nicolás Pernas Maradei
2014-09-29 13:21 ` Thomas Monjalon
2014-09-29 14:24 ` Neil Horman
2014-10-04 18:14   ` Nicolás Pernas Maradei [this message]
2014-10-06 14:35     ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ab24cf8da0f11aa07b6770883de356a@statler.emutex.com \
    --to=nico@emutex.com \
    --cc=dev@dpdk.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).