Skip to content

Commit f3efb95

Browse files
ij-intelbjorn-helgaas
authored andcommitted
PCI: Fix lock symmetry in pci_slot_unlock()
The commit a4e7728 ("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(). Because of the asymmetric lock handling, the same bridge device is unlocked twice. First pci_bus_unlock() unlocks bus->self and then pci_slot_unlock() will unconditionally unlock the same bridge device. Move pci_dev_unlock() inside an else branch to match the logic in pci_slot_lock(). Fixes: a4e7728 ("PCI: Add missing bridge lock to pci_bus_lock()") Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Lukas Wunner <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Cc: [email protected] Link: https://patch.msgid.link/[email protected]
1 parent 0af2f6b commit f3efb95

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pci/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5542,7 +5542,8 @@ static void pci_slot_unlock(struct pci_slot *slot)
55425542
continue;
55435543
if (dev->subordinate)
55445544
pci_bus_unlock(dev->subordinate);
5545-
pci_dev_unlock(dev);
5545+
else
5546+
pci_dev_unlock(dev);
55465547
}
55475548
}
55485549

0 commit comments

Comments
 (0)