From: Bhavna Sarathy <bnagendr@redhat.com> Date: Mon, 8 Jun 2009 15:37:40 -0400 Subject: [x86_64] amd iommu: fix spinlock imbalance Message-id: 20090608193844.7837.79868.sendpatchset@localhost.localdomain O-Subject: [RHEL5.4 PATCH 5/5] [KVM] Fix spinlock imbalance in AMD IOMMU driver Bugzilla: 501571 RH-Acked-by: Rik van Riel <riel@redhat.com> RH-Acked-by: Juan Quintela <quintela@redhat.com> RH-Acked-by: Don Dutile <ddutile@redhat.com> Resolves BZ 501571 In alloc_coherent there is an omitted unlock on the path where mapping fails. Add the unlock. diff --git a/arch/x86_64/kernel/amd_iommu.c b/arch/x86_64/kernel/amd_iommu.c index 5379f85..75176eb 100644 --- a/arch/x86_64/kernel/amd_iommu.c +++ b/arch/x86_64/kernel/amd_iommu.c @@ -1536,8 +1536,10 @@ static void *alloc_coherent(struct device *dev, size_t size, *dma_addr = __map_single(dev, iommu, domain->priv, paddr, size, DMA_BIDIRECTIONAL, true, dma_mask); - if (*dma_addr == bad_dma_address) + if (*dma_addr == bad_dma_address) { + spin_unlock_irqrestore(&domain->lock, flags); goto out_free; + } iommu_completion_wait(iommu);