linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] PCI: protect restore with device lock to be consistent
@ 2017-09-24  0:16 Sinan Kaya
  2017-09-24  0:16 ` [PATCH 2/5] PCI: handle FLR failure and allow other reset types Sinan Kaya
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Sinan Kaya @ 2017-09-24  0:16 UTC (permalink / raw)
  To: linux-pci, timur, alex.williamson
  Cc: Sinan Kaya, linux-arm-msm, Bjorn Helgaas, linux-kernel,
	linux-arm-kernel

Commit b014e96d1abb ("PCI: Protect pci_error_handlers->reset_notify() usage
with device_lock()") added protection around pci_dev_restore() function so
that device specific remove callback does not cause a race condition
against hotplug.

pci_dev_lock() usage has been forgotten in two different places in the
code. Adding locks for pci_slot_restore() and moving pci_dev_restore()
inside the locks for pci_try_reset_function().

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6078dfc..23681f4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4344,9 +4344,9 @@ int pci_try_reset_function(struct pci_dev *dev)
 
 	pci_dev_save_and_disable(dev);
 	rc = __pci_reset_function_locked(dev);
+	pci_dev_restore(dev);
 	pci_dev_unlock(dev);
 
-	pci_dev_restore(dev);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(pci_try_reset_function);
@@ -4546,7 +4546,9 @@ static void pci_slot_restore(struct pci_slot *slot)
 	list_for_each_entry(dev, &slot->bus->devices, bus_list) {
 		if (!dev->slot || dev->slot != slot)
 			continue;
+		pci_dev_lock(dev);
 		pci_dev_restore(dev);
+		pci_dev_unlock(dev);
 		if (dev->subordinate)
 			pci_bus_restore(dev->subordinate);
 	}
-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-10-16 12:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-24  0:16 [PATCH 1/5] PCI: protect restore with device lock to be consistent Sinan Kaya
2017-09-24  0:16 ` [PATCH 2/5] PCI: handle FLR failure and allow other reset types Sinan Kaya
2017-10-11 21:00   ` Bjorn Helgaas
2017-10-12 16:42     ` Sinan Kaya
2017-09-24  0:16 ` [PATCH 3/5] PCI: make pci_flr_wait() generic and rename to pci_dev_wait() Sinan Kaya
2017-09-24 13:08   ` Christoph Hellwig
2017-09-25  0:30     ` Sinan Kaya
2017-09-24  0:16 ` [PATCH 4/5] PCI: wait device ready after pci_pm_reset() Sinan Kaya
2017-10-11 22:06   ` Bjorn Helgaas
2017-10-12 16:48     ` Sinan Kaya
2017-10-16 12:51       ` Sinan Kaya
2017-09-24  0:16 ` [PATCH 5/5] PCI: add device wait after slot and bus reset Sinan Kaya
2017-09-24  0:20   ` Sinan Kaya
2017-10-11 22:08 ` [PATCH 1/5] PCI: protect restore with device lock to be consistent Bjorn Helgaas
2017-10-12 16:39   ` Sinan Kaya

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).