PCI: Fix lock symmetry in pci_slot_unlock()
PATCH 1/1 PCI: Fix lock symmetry in pci_slot_unlock()
The commit a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()") made the lock function to call depend on dev->subordinate but left pci_slot_unlock() unmodified creating locking asymmetry compared with pci_slot_lock().
Move pci_dev_unlock() inside an else branch to match the logic in pci_slot_lock().
--- drivers/pci/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci.c +2 -1
@@ -5542,7 +5542,8 @@ static void pci_slot_unlock(struct pci_slot *slot)continue ;if (dev->subordinate)pci_bus_unlock (dev->subordinate); -pci_dev_unlock (dev); +else +pci_dev_unlock (dev); } }
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
Signature · 1 line
2.39.5
Quoted 4 lines · Ilpo Järvinen
The commit
a4e772898f8b("PCI: Add missing bridge lock topci_bus_lock()") made the lock function to call depend ondev->subordinatebut leftpci_slot_unlock()unmodified creating locking asymmetry compared withpci_slot_lock().
Worth noting that this isn't just for symmetry: It seems the bridge is unlocked twice because pci_bus_unlock() unlocks bus->self and pci_slot_unlock() then unconditionally unlocks the same bridge device again.
Thanks,
Lukas