Skip to content

Commit 68ea85d

Browse files
hmadhaniKAGA-KOKO
authored andcommitted
PCI/MSI: Prevent recursive locking in pci_msix_write_tph_tag()
pci_msix_write_tph_tag() takes the per device MSI descriptor mutex and then invokes msi_domain_get_virq(), which takes the same mutex again. That obviously results in a system hang which is exposed by a softlockup or lockdep warning. Move the lock guard after the invocation of msi_domain_get_virq() to fix this. [ tglx: Massage changelog by adding a proper explanation and removing the not really useful stacktrace ] Fixes: d5124a9 ("PCI/MSI: Provide a sane mechanism for TPH") Reported-by: Jorge Lopez <[email protected]> Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Jorge Lopez <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent d7b8f8e commit 68ea85d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pci/msi/msi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,10 +934,12 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)
934934
if (!pdev->msix_enabled)
935935
return -ENXIO;
936936

937-
guard(msi_descs_lock)(&pdev->dev);
938937
virq = msi_get_virq(&pdev->dev, index);
939938
if (!virq)
940939
return -ENXIO;
940+
941+
guard(msi_descs_lock)(&pdev->dev);
942+
941943
/*
942944
* This is a horrible hack, but short of implementing a PCI
943945
* specific interrupt chip callback and a huge pile of

0 commit comments

Comments
 (0)