Skip to content

Commit 78fbe6c

Browse files
author
Myron Stowe
committed
PCI/MSI: Prevent recursive locking in pci_msix_write_tph_tag()
JIRA: https://issues.redhat.com/browse/RHEL-120705 Upstream Status: 68ea85d commit 68ea85d Author: Himanshu Madhani <himanshu.madhani@oracle.com> Date: Tue Jul 8 22:25:30 2025 +0000 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 <jorge.jo.lopez@oracle.com> Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Jorge Lopez <jorge.jo.lopez@oracle.com> Link: https://lore.kernel.org/all/20250708222530.1041477-1-himanshu.madhani@oracle.com Signed-off-by: Myron Stowe <mstowe@redhat.com>
1 parent 3a3ed34 commit 78fbe6c

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
@@ -931,10 +931,12 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)
931931
if (!pdev->msix_enabled)
932932
return -ENXIO;
933933

934-
guard(msi_descs_lock)(&pdev->dev);
935934
virq = msi_get_virq(&pdev->dev, index);
936935
if (!virq)
937936
return -ENXIO;
937+
938+
guard(msi_descs_lock)(&pdev->dev);
939+
938940
/*
939941
* This is a horrible hack, but short of implementing a PCI
940942
* specific interrupt chip callback and a huge pile of

0 commit comments

Comments
 (0)