[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191018220525.9042-47-sashal@kernel.org>
Date: Fri, 18 Oct 2019 18:04:32 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Sven Van Asbroeck <thesven73@...il.com>,
Sven Van Asbroeck <TheSven73@...il.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Sinan Kaya <okaya@...nel.org>,
Frederick Lawler <fred@...dlawl.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Keith Busch <keith.busch@...el.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Sasha Levin <sashal@...nel.org>, linux-pci@...r.kernel.org
Subject: [PATCH AUTOSEL 4.19 047/100] PCI/PME: Fix possible use-after-free on remove
From: Sven Van Asbroeck <thesven73@...il.com>
[ 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@...il.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Sinan Kaya <okaya@...nel.org>
Cc: Frederick Lawler <fred@...dlawl.com>
Cc: Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: Keith Busch <keith.busch@...el.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/pci/pcie/pme.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index e85c5a8206c43..6ac17f0c40775 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.20.1
Powered by blists - more mailing lists