]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PCI/PME: Fix possible use-after-free on remove
authorSven Van Asbroeck <thesven73@gmail.com>
Fri, 1 Mar 2019 16:54:19 +0000 (11:54 -0500)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 13 Nov 2019 23:47:34 +0000 (18:47 -0500)
BugLink: https://bugs.launchpad.net/bugs/1852492
[ Upstream commit 7cf58b79b3072029af127ae865ffc6f00f34b1f8 ]

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.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
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: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/pci/pcie/pme.c

index c2e6e3d1073f82c13bed28b4e8a67fc76b80a1c0..5500660bbb1043436da66dfe1cc58d71c1b32b25 100644 (file)
@@ -441,6 +441,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);
 }