From: Keith Busch <keith.busch@intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Thomas Tai <thomas.tai@oracle.com>,
bhelgaas@google.com, poza@codeaurora.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH V2, 0/1] PCI/AER: fix use-after-free in pcie_do_fatal_recovery
Date: Thu, 12 Jul 2018 15:57:01 -0600 [thread overview]
Message-ID: <20180712215700.GA17092@localhost.localdomain> (raw)
In-Reply-To: <20180712215151.GD28466@bhelgaas-glaptop.roam.corp.google.com>
On Thu, Jul 12, 2018 at 04:51:51PM -0500, Bjorn Helgaas wrote:
> However, I think we're also slightly exposed in dpc_work(), in basically
> the same (possibly harmless) way.
>
> dpc_irq
> schedule_work(&dpc->work)
> ...
> dpc_work
> pdev = dpc->dev->port
> pcie_do_fatal_recovery(pdev)
>
> pdev may be removed by pcie_do_fatal_recovery(), but dpc_work() is still
> holding onto a pointer (which it never uses again).
>
> The DPC driver should be holding a reference to pdev (through some black
> magic I don't understand), but that would be released when pdev is removed,
> and I don't know what ensures that dpc_work() runs before that release.
>
> Bjorn
Yep, you're right on that point. There's different ways we can fix
that. The most recent one I proposed was to replace the scheduled work
with the threaded irq[1]. That should make it safe since the lifetime of
when bottom half can be executed is tied to the lifetime of the device
that registered it.
1. https://patchwork.kernel.org/patch/10478755/
next prev parent reply other threads:[~2018-07-12 21:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 17:33 [PATCH V2, 0/1] PCI/AER: fix use-after-free in pcie_do_fatal_recovery Thomas Tai
2018-07-12 17:33 ` [PATCH V2, 1/1] " Thomas Tai
2018-07-12 21:51 ` [PATCH V2, 0/1] " Bjorn Helgaas
2018-07-12 21:57 ` Keith Busch [this message]
2018-07-16 14:06 ` Thomas Tai
2018-07-18 21:16 ` Bjorn Helgaas
2018-07-18 21:43 ` Thomas Tai
2018-07-18 21:57 ` Bjorn Helgaas
2018-07-15 18:55 ` poza
2018-07-16 14:00 ` Keith Busch
2018-07-16 14:17 ` Thomas Tai
2018-07-18 21:32 ` Thomas Tai
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=20180712215700.GA17092@localhost.localdomain \
--to=keith.busch@intel.com \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=poza@codeaurora.org \
--cc=thomas.tai@oracle.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).