# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1252327775 -3600
# Node ID b81e375e03922cd72d6e1404bc62a05059a4fe61
# Parent a2ab11e31f9123b11f83465ffd7622fa49806e4d
vt-d: avoid obtaining iommu->register_lock too early in
dma_msi_set_affinity()
If set_desc_affinity() fails, the current code doesn't release the
spinlock. We should obtain the lock at a later place.
Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
xen/drivers/passthrough/vtd/iommu.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -r a2ab11e31f91 -r b81e375e0392 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Mon Sep 07 09:00:21 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c Mon Sep 07 13:49:35 2009 +0100
@@ -826,7 +826,6 @@ static void dma_msi_set_affinity(unsigne
struct irq_desc *desc = irq_to_desc(irq);
struct irq_cfg *cfg = desc->chip_data;
- spin_lock_irqsave(&iommu->register_lock, flags);
#ifdef CONFIG_X86
dest = set_desc_affinity(desc, mask);
if (dest == BAD_APICID){
@@ -862,6 +861,7 @@ static void dma_msi_set_affinity(unsigne
msg.address_lo |= dest << MSI_TARGET_CPU_SHIFT;
#endif
+ spin_lock_irqsave(&iommu->register_lock, flags);
dmar_writel(iommu->reg, DMAR_FEDATA_REG, msg.data);
dmar_writel(iommu->reg, DMAR_FEADDR_REG, msg.address_lo);
dmar_writel(iommu->reg, DMAR_FEUADDR_REG, msg.address_hi);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|