DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Cc: dev@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	gaetan.rivet@6wind.com
Subject: Re: [dpdk-dev] [PATCH v3] dev: don't remove devargs that are still referenced
Date: Sun, 25 Nov 2018 13:46:36 +0100	[thread overview]
Message-ID: <3623854.KDShfdj67N@xps> (raw)
In-Reply-To: <db643517-a8d3-2341-79e4-45e76fb3f090@redhat.com>

23/11/2018 18:04, Maxime Coquelin:
> Hi,
> 
> On 11/23/18 4:43 PM, Darek Stojaczyk wrote:
> > Even if a device failed to plug, it's still a device
> > object that references the devargs. Those devargs will
> > be freed automatically together with the device, but
> > freeing them any earlier - like it's done in the hotplug
> > error handling path right now - will give us a dangling
> > pointer and a segfault scenario.
> > 
> > Consider the following case:
> >   * secondary process receives the hotplug request IPC message
> >     * devargs are either created or updated
> >     * the bus is scanned
> >       * a new device object is created with the latest devargs
> >     * the device can't be plugged for whatever reason,
> >       bus->plug returns error
> >       * the devargs are freed, even though they're still referenced
> >         by the device object on the bus
> > 
> > For PCI devices, the generic device name comes from
> > a buffer within the devargs. Freeing those will make
> > EAL segfault whenever the device name is checked.
> > 
> > This patch just prevents the hotplug error handling
> > path from removing the devargs when there's a device
> > that references them. This is done by simply exiting
> > early from the hotplug function. As mentioned in the
> > beginning, those devargs will be freed later, together
> > with the device itself.
> > 
> > Fixes: 7e8b26650146 ("eal: fix hotplug add / remove")
> 
> Should you also cc stable?
> Above commit is in since v17.08.
> 
> > Cc: gaetan.rivet@6wind.com
> > Cc: thomas@monjalon.net
> > 
> > Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
> Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>

Applied (with rebase), thanks

      parent reply	other threads:[~2018-11-25 12:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 18:37 [dpdk-dev] [PATCH] " Darek Stojaczyk
2018-11-21 18:55 ` Thomas Monjalon
2018-11-21 19:38 ` [dpdk-dev] [PATCH v2] " Darek Stojaczyk
2018-11-22  9:54   ` Gaëtan Rivet
2018-11-22 12:54     ` Stojaczyk, Dariusz
2018-11-23 15:43   ` [dpdk-dev] [PATCH v3] " Darek Stojaczyk
2018-11-23 17:04     ` Maxime Coquelin
2018-11-23 21:45       ` Stojaczyk, Dariusz
2018-11-25 12:46       ` Thomas Monjalon [this message]

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=3623854.KDShfdj67N@xps \
    --to=thomas@monjalon.net \
    --cc=dariusz.stojaczyk@intel.com \
    --cc=dev@dpdk.org \
    --cc=gaetan.rivet@6wind.com \
    --cc=maxime.coquelin@redhat.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).