linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sinan Kaya <okaya@kernel.org>,
	Frederick Lawler <fred@fredlawl.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Keith Busch <keith.busch@intel.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH v2] PCIE/PME: fix possible use-after-free on remove
Date: Fri, 1 Mar 2019 18:11:12 -0600	[thread overview]
Message-ID: <CAErSpo74LHWaHtjPGthyNvAgrq7wb0G0dbh9krzMQH0cK-DE9g@mail.gmail.com> (raw)
In-Reply-To: <20190301165419.16493-1-TheSven73@gmail.com>

On Fri, Mar 1, 2019 at 10:54 AM Sven Van Asbroeck <thesven73@gmail.com> wrote:
>
> In remove(), ensure that the pme work cannot run after kfree()
> is called. Otherwise, this could result in a use-after-free.
>
> This issue was detected with the help of Coccinelle.
>
> Cc: Sinan Kaya <okaya@kernel.org>
> Cc: Frederick Lawler <fred@fredlawl.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>

Applied to pci/pm for v5.1, thanks!

> ---
>  drivers/pci/pcie/pme.c | 1 +
>  1 file changed, 1 insertion(+)
>
> v2:
>         rebased against Bjorn Helgaas's pcm/pm branch at
>         git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
>
> diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
> index efa5b552914b..54d593d10396 100644
> --- a/drivers/pci/pcie/pme.c
> +++ b/drivers/pci/pcie/pme.c
> @@ -437,6 +437,7 @@ static void pcie_pme_remove(struct pcie_device *srv)
>
>         pcie_pme_disable_interrupt(srv->port, data);
>         free_irq(srv->irq, srv);
> +       cancel_work_sync(&data->work);
>         kfree(data);
>  }
>
> --
> 2.17.1
>

      reply	other threads:[~2019-03-02  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 16:54 [PATCH v2] PCIE/PME: fix possible use-after-free on remove Sven Van Asbroeck
2019-03-02  0:11 ` Bjorn Helgaas [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=CAErSpo74LHWaHtjPGthyNvAgrq7wb0G0dbh9krzMQH0cK-DE9g@mail.gmail.com \
    --to=bhelgaas@google.com \
    --cc=fred@fredlawl.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=okaya@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=thesven73@gmail.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).