Skip to content

Commit 0eb1b2e

Browse files
ij-intelsmb49
authored andcommitted
PCI: Fix lock symmetry in pci_slot_unlock()
BugLink: https://bugs.launchpad.net/bugs/2120812 commit f3efb9569b4a21354ef2caf7ab0608a3e14cc6e4 upstream. 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 <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20250505115412.37628-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Noah Wager <noah.wager@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 331d9a3 commit 0eb1b2e

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
@@ -5536,7 +5536,8 @@ static void pci_slot_unlock(struct pci_slot *slot)
55365536
continue;
55375537
if (dev->subordinate)
55385538
pci_bus_unlock(dev->subordinate);
5539-
pci_dev_unlock(dev);
5539+
else
5540+
pci_dev_unlock(dev);
55405541
}
55415542
}
55425543

0 commit comments

Comments
 (0)