All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: fix race between free_irte() and get_irte()
@ 2014-07-22 14:27 ` Greg Edwards
  0 siblings, 0 replies; 16+ messages in thread
From: Greg Edwards @ 2014-07-22 14:27 UTC (permalink / raw)
  To: Joerg Roedel, David Woodhouse; +Cc: iommu, linux-kernel

get_irte() can race with free_irte() and dereference a NULL iommu
pointer.

Signed-off-by: Greg Edwards <gedwards@ddn.com>
Cc: stable@vger.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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-07-31 11:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-22 14:27 [PATCH] iommu/vt-d: fix race between free_irte() and get_irte() Greg Edwards
2014-07-22 14:27 ` Greg Edwards
2014-07-23 14:40 ` Joerg Roedel
2014-07-23 14:40   ` Joerg Roedel
2014-07-23 14:49   ` Greg Edwards
2014-07-23 14:49     ` Greg Edwards
2014-07-23 15:10     ` Joerg Roedel
2014-07-23 15:10       ` Joerg Roedel
2014-07-23 16:13       ` [PATCH v2] iommu/vt-d: race setting IRQ CPU affinity while freeing IRQ Greg Edwards
2014-07-23 16:13         ` Greg Edwards
2014-07-29 10:45         ` Joerg Roedel
2014-07-29 10:45           ` Joerg Roedel
2014-07-29 17:21           ` Greg Edwards
2014-07-29 17:21             ` Greg Edwards
2014-07-31 11:49             ` Joerg Roedel
2014-07-31 11:49               ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.