From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Jonathan Creekmore <jonathan.creekmore@gmail.com>,
Doug Goldstein <cardoe@cardoe.com>,
linux-kernel@vger.kernel.org,
Paul Durrant <paul.durrant@citrix.com>,
xen-devel@lists.xenproject.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH] xen-pciback: fix up cleanup path when alloc fails
Date: Mon, 14 Dec 2015 15:21:02 -0500 [thread overview]
Message-ID: <20151214202102.GA25842@char.us.oracle.com> (raw)
In-Reply-To: <566EE96D.7090106@citrix.com>
On Mon, Dec 14, 2015 at 04:08:13PM +0000, David Vrabel wrote:
> On 02/12/15 14:56, Doug Goldstein wrote:
> > On 12/2/15 4:35 AM, David Vrabel wrote:
> >> On 26/11/15 20:32, Doug Goldstein wrote:
> >>> When allocating a pciback device fails, avoid the possibility of a
> >>> use after free.
> >>
> >> We should not require clearing drvdata for correctness. We should
> >> ensure we retain drvdata for as long as it is needed.
> >>
> >> I note that pcistub_device_release() has:
> >>
> >> kfree(dev_data);
> >> pci_set_drvdata(dev, NULL);
> >>
> >> /* Clean-up the device */
> >> xen_pcibk_config_free_dyn_fields(dev);
> >> xen_pcibk_config_free_dev(dev);
> >>
> >> Which should (at a minimum) be reordered to move the kfree(dev_data) to
> >> after the calls that require it
> >>
> >> David
> >>
> >
> > I apologize but at this point I'm confused at what action I should be
> > taking. Are you saying NACK to the original patch and suggesting this as
> > the replacement? Or saying that this should be done in addition to the
> > original patch?
>
> I'm suggesting that the goal should be to remove all
> pci_set_drvdata(dev, NULL) calls and have pciback work correctly without
> them.
Which would mean backend/frontend drivers to do this as well.
>
> Konrad's the pciback maintainer though so I'll defer to him on this.
I would take the patch as is. The cleanup (pci_set_drvdata(dev, NULL)) can
be done another time.
>
> David
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-12-14 20:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 20:32 [PATCH] xen-pciback: fix up cleanup path when alloc fails Doug Goldstein
2015-11-30 21:09 ` Boris Ostrovsky
2015-11-30 21:09 ` Boris Ostrovsky
2015-12-01 16:47 ` Konrad Rzeszutek Wilk
2015-12-01 19:24 ` Doug Goldstein
2015-12-01 19:24 ` Doug Goldstein
2015-12-01 19:35 ` Konrad Rzeszutek Wilk
2015-12-01 20:54 ` Doug Goldstein
2015-12-01 20:54 ` Doug Goldstein
2015-12-01 21:34 ` Konrad Rzeszutek Wilk
2015-12-02 10:35 ` David Vrabel
2015-12-02 14:56 ` Doug Goldstein
2015-12-14 16:08 ` David Vrabel
2015-12-14 16:08 ` [Xen-devel] " David Vrabel
2015-12-14 20:21 ` Konrad Rzeszutek Wilk [this message]
2015-12-02 14:56 ` Doug Goldstein
2015-12-02 10:35 ` David Vrabel
-- strict thread matches above, loose matches on Subject: below --
2015-11-26 20:32 Doug Goldstein
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=20151214202102.GA25842@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=cardoe@cardoe.com \
--cc=david.vrabel@citrix.com \
--cc=jonathan.creekmore@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.durrant@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.