Re: [RESEND PATCH] PCI: fix recursive device locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 09, 2024 at 12:57:16PM -0700, Keith Busch wrote:
> @@ -5488,9 +5488,10 @@ static void pci_bus_lock(struct pci_bus *bus)
>  
>  	pci_dev_lock(bus->self);
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
> -		pci_dev_lock(dev);
>  		if (dev->subordinate)
>  			pci_bus_lock(dev->subordinate);
> +		else
> +			pci_dev_lock(dev);
>  	}
>  }
>  
> @@ -5502,7 +5503,8 @@ static void pci_bus_unlock(struct pci_bus *bus)
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>  		if (dev->subordinate)
>  			pci_bus_unlock(dev->subordinate);
> -		pci_dev_unlock(dev);
> +		else
> +			pci_dev_unlock(dev);
>  	}
>  	pci_dev_unlock(bus->self);
>  }

I realized pci_slot_lock() has the same problem. I wasn't able to test
that path from not having a pcie topology with a subordinate on the slot
device, but it follows the same pattern. Same thing with
pci_bus_trylock() for that matter, so I will make a new version.




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux