Skip to content

Commit

Permalink
PCI: vmd: Fix potential deadlock when enabling ASPM
Browse files Browse the repository at this point in the history
The vmd_pm_enable_quirk() helper is called from pci_walk_bus() during
probe to enable ASPM for controllers with VMD_FEAT_BIOS_PM_QUIRK set.

Since pci_walk_bus() already holds a pci_bus_sem read lock, use
pci_enable_link_state_locked() to enable link states in order to avoid a
potential deadlock (e.g. in case someone takes a write lock before
reacquiring the read lock).

Fixes: f492edb ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johan Hovold <[email protected]>
[bhelgaas: add "potential" in subject since the deadlock has only been
reported by lockdep, include helper name in commit log]
Signed-off-by: Bjorn Helgaas <[email protected]>
Reviewed-by: Manivannan Sadhasivam <[email protected]>
Cc: <[email protected]>	# 6.3
Cc: Michael Bottini <[email protected]>
Cc: David E. Box <[email protected]>
  • Loading branch information
jhovold authored and bjorn-helgaas committed Dec 11, 2023
1 parent 718ab82 commit 49de0dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/controller/vmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata)
if (!(features & VMD_FEAT_BIOS_PM_QUIRK))
return 0;

pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL);
pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL);

pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR);
if (!pos)
Expand Down

0 comments on commit 49de0dc

Please sign in to comment.