Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: Fix missing update in pci_slot_unlock() after locking changes
@ 2025-05-04 16:31 Moshe Shemesh
  2025-05-04 17:53 ` Lukas Wunner
  0 siblings, 1 reply; 3+ messages in thread
From: Moshe Shemesh @ 2025-05-04 16:31 UTC (permalink / raw)
  To: Bjorn Helgaas, Dan Williams, Dave Jiang, Keith Busch, linux-pci
  Cc: 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()")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
---
 drivers/pci/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 4d7c9f64ea24..26507aa906d7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -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);
 	}
 }
 
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: Fix missing update in pci_slot_unlock() after locking changes
  2025-05-04 16:31 [PATCH] PCI: Fix missing update in pci_slot_unlock() after locking changes Moshe Shemesh
@ 2025-05-04 17:53 ` Lukas Wunner
  2025-05-04 20:16   ` Moshe Shemesh
  0 siblings, 1 reply; 3+ messages in thread
From: Lukas Wunner @ 2025-05-04 17:53 UTC (permalink / raw)
  To: Moshe Shemesh, Ilpo Järvinen
  Cc: Bjorn Helgaas, Dan Williams, Dave Jiang, Keith Busch, linux-pci

On Sun, May 04, 2025 at 07:31:32PM +0300, Moshe Shemesh wrote:
> 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()")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>

Ilpo already submitted an identical patch on April 30:

https://lore.kernel.org/r/20250430083526.4276-1-ilpo.jarvinen@linux.intel.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: Fix missing update in pci_slot_unlock() after locking changes
  2025-05-04 17:53 ` Lukas Wunner
@ 2025-05-04 20:16   ` Moshe Shemesh
  0 siblings, 0 replies; 3+ messages in thread
From: Moshe Shemesh @ 2025-05-04 20:16 UTC (permalink / raw)
  To: Lukas Wunner, Ilpo Järvinen
  Cc: Bjorn Helgaas, Dan Williams, Dave Jiang, Keith Busch, linux-pci



On 5/4/2025 8:53 PM, Lukas Wunner wrote:
> 
> On Sun, May 04, 2025 at 07:31:32PM +0300, Moshe Shemesh wrote:
>> 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()")
>> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> 
> Ilpo already submitted an identical patch on April 30:
> 
> https://lore.kernel.org/r/20250430083526.4276-1-ilpo.jarvinen@linux.intel.com/

I missed it, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-04 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-04 16:31 [PATCH] PCI: Fix missing update in pci_slot_unlock() after locking changes Moshe Shemesh
2025-05-04 17:53 ` Lukas Wunner
2025-05-04 20:16   ` Moshe Shemesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox