[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1514912423-13341-2-git-send-email-okaya@codeaurora.org>
Date: Tue, 2 Jan 2018 12:00:18 -0500
From: Sinan Kaya <okaya@...eaurora.org>
To: linux-pci@...r.kernel.org, timur@...eaurora.org
Cc: linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Sinan Kaya <okaya@...eaurora.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH V3 1/6] PCI: Protect restore with device lock to be consistent
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@...eaurora.org>
Reviewed-by: Christoph Hellwig <hch@....de>
---
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 764ca7b..463b32d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4448,9 +4448,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);
@@ -4658,7 +4658,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
Powered by blists - more mailing lists