[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140722142719.GA28143@psuche.datadirectnet.com>
Date: Tue, 22 Jul 2014 08:27:19 -0600
From: Greg Edwards <gedwards@....com>
To: Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>
CC: <iommu@...ts.linux-foundation.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] iommu/vt-d: fix race between free_irte() and get_irte()
get_irte() can race with free_irte() and dereference a NULL iommu
pointer.
Signed-off-by: Greg Edwards <gedwards@....com>
Cc: stable@...r.kernel.org
---
drivers/iommu/intel_irq_remapping.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9b17489..2d67e6d 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -70,6 +70,12 @@ static int get_irte(int irq, struct irte *entry)
raw_spin_lock_irqsave(&irq_2_ir_lock, flags);
+ /* ensure we're not racing with free_irte() */
+ if (unlikely(!irq_iommu->iommu)) {
+ raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
+ return -1;
+ }
+
index = irq_iommu->irte_index + irq_iommu->sub_handle;
*entry = *(irq_iommu->iommu->ir_table->base + index);
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists