Skip to contentSkip to conversation

PCI: Fix missing update in pci_slot_unlock() after locking changes

PATCH In review Moshe Shemesh 2 participants 3 messages May 4, 2025 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Fix missing update in pci_slot_unlock() after locking changes

The cited patch updated pci_slot_lock(), pci_slot_trylock(), pci_bus_lock(), and pci_bus_trylock() recursive locking, and adjusted pci_bus_unlock() accordingly. However, it missed updating pci_slot_unlock(), which may lead to attempting to unlock the subordinate bridge's device lock twice.

Fixes a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")
---
 drivers/pci/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci.c +2 -1
index 4d7c9f64ea24..26507aa906d7 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.18.2
#1 lore raw
Quoted 8 lines · Moshe Shemesh

The cited patch updated pci_slot_lock(), pci_slot_trylock(), pci_bus_lock(), and pci_bus_trylock() recursive locking, and adjusted pci_bus_unlock() accordingly. However, it missed updating pci_slot_unlock(), which may lead to attempting to unlock the subordinate bridge's device lock twice.

Fixes a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")

Ilpo already submitted an identical patch on April 30:

https://lore.kernel.org/r/[email protected]/

#2 lore raw
Quoted 8 lines · Lukas Wunner
Quoted 6 lines · Moshe Shemesh

The cited patch updated pci_slot_lock(), pci_slot_trylock(), pci_bus_lock(), and pci_bus_trylock() recursive locking, and adjusted pci_bus_unlock() accordingly. However, it missed updating pci_slot_unlock(), which may lead to attempting to unlock the subordinate bridge's device lock twice.

Quoted 6 lines
Quoted 2 lines
Fixes a4e772898f8b ("PCI: Add missing bridge lock to pci_bus_lock()")

Ilpo already submitted an identical patch on April 30:

https://lore.kernel.org/r/[email protected]/

I missed it, thanks.