* [PATCH] iommu/vt-d: Initialize prq_complete before requesting PRQ IRQ
@ 2026-11-25 22:24 Elkin Cruz
0 siblings, 0 replies; only message in thread
From: Elkin Cruz @ 2026-11-25 22:24 UTC (permalink / raw)
To: David Woodhouse, Lu Baolu, Joerg Roedel (AMD), Will Deacon
Cc: Robin Murphy, iommu, linux-kernel, llvm, irogers, Elkin Cruz, stable
In intel_iommu_enable_prq(), request_threaded_irq() is called before
init_completion(&iommu->prq_complete). The interrupt thread
prq_event_thread() invokes complete(&iommu->prq_complete) upon receiving
events. If an interrupt fires immediately upon registration or after
enabling PRQ in DMAR_PQA_REG, the thread can access an uninitialized
completion structure.
Move init_completion(&iommu->prq_complete) before requesting the IRQ.
Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
Cc: stable@vger.kernel.org
Signed-off-by: Elkin Cruz <elkin@google.com>
---
I am trying out new Clang static analysis checks for kernel bug
classes, and they flagged this code as possibly buggy. The findings
were triaged/fixed and commit descriptions were drafted with help of AI,
then checked against linux-next (not runtime-tested on hardware).
Thanks,
Elkin
drivers/iommu/intel/prq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/intel/prq.c b/drivers/iommu/intel/prq.c
index dddd3b51b657..7bf22ce7978d 100644
--- a/drivers/iommu/intel/prq.c
+++ b/drivers/iommu/intel/prq.c
@@ -318,6 +318,8 @@ int intel_iommu_enable_prq(struct intel_iommu *iommu)
snprintf(iommu->prq_name, sizeof(iommu->prq_name), "dmar%d-prq", iommu->seq_id);
+ init_completion(&iommu->prq_complete);
+
ret = request_threaded_irq(irq, NULL, prq_event_thread, IRQF_ONESHOT,
iommu->prq_name, iommu);
if (ret) {
@@ -329,8 +331,6 @@ int intel_iommu_enable_prq(struct intel_iommu *iommu)
writeq(0ULL, iommu->reg + DMAR_PQT_REG);
writeq(virt_to_phys(iommu->prq) | PRQ_ORDER, iommu->reg + DMAR_PQA_REG);
- init_completion(&iommu->prq_complete);
-
return 0;
free_iopfq:
--
2.56.1.839.g22a8290db9-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-25 22:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 22:24 [PATCH] iommu/vt-d: Initialize prq_complete before requesting PRQ IRQ Elkin Cruz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®