[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <175218401725.406.6167258058407425293.tip-bot2@tip-bot2>
Date: Thu, 10 Jul 2025 21:46:57 -0000
From: "tip-bot2 for Himanshu Madhani" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Jorge Lopez <jorge.jo.lopez@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Himanshu Madhani <himanshu.madhani@...cle.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/urgent] PCI/MSI: Prevent recursive locking in
pci_msix_write_tph_tag()
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 68ea85df15d111d82fc474cbe104174791169355
Gitweb: https://git.kernel.org/tip/68ea85df15d111d82fc474cbe104174791169355
Author: Himanshu Madhani <himanshu.madhani@...cle.com>
AuthorDate: Tue, 08 Jul 2025 22:25:30
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Thu, 10 Jul 2025 23:41:08 +02:00
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: d5124a9957b2 ("PCI/MSI: Provide a sane mechanism for TPH")
Reported-by: Jorge Lopez <jorge.jo.lopez@...cle.com>
Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: Himanshu Madhani <himanshu.madhani@...cle.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Jorge Lopez <jorge.jo.lopez@...cle.com>
Link: https://lore.kernel.org/all/20250708222530.1041477-1-himanshu.madhani@oracle.com
---
drivers/pci/msi/msi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 6ede55a..d686488 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -934,10 +934,12 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)
if (!pdev->msix_enabled)
return -ENXIO;
- guard(msi_descs_lock)(&pdev->dev);
virq = msi_get_virq(&pdev->dev, index);
if (!virq)
return -ENXIO;
+
+ guard(msi_descs_lock)(&pdev->dev);
+
/*
* This is a horrible hack, but short of implementing a PCI
* specific interrupt chip callback and a huge pile of
Powered by blists - more mailing lists