OSDN Git Service

PCI: Fix "try" semantics of bus and slot reset
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 18 Feb 2019 19:46:46 +0000 (12:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:30 +0000 (14:50 +0100)
commitac91c872959659147c59746049e7d05125fa92b4
treefe90543478c749bf50b41f83ff9a9051895bf59e
parent080ba12cc1ce27b408e4de35f7ec7c7bf0615a4d
PCI: Fix "try" semantics of bus and slot reset

[ Upstream commit ddefc033eecf23f1e8b81d0663c5db965adf5516 ]

The commit referenced below introduced device locking around save and
restore of state for each device during a PCI bus "try" reset, making it
decidely non-"try" and prone to deadlock in the event that a device is
already locked.  Restore __pci_reset_bus() and __pci_reset_slot() to their
advertised locking semantics by pushing the save and restore functions into
the branch where the entire tree is already locked.  Extend the helper
function names with "_locked" and update the comment to reflect this
calling requirement.

Fixes: b014e96d1abb ("PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/pci.c