[PATCH] [102/106] From: intel-iommu: Fix use after release during device attach

From: Andi Kleen
Date: Tue Apr 26 2011 - 17:18:05 EST


2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
Date: Tue, 2 Nov 2010 08:05:51 +0100
Subject: [PATCH] intel-iommu: Fix use after release during device attach

Obtain the new pgd pointer before releasing the page containing this
value.

Cc: stable@xxxxxxxxxx
Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Reviewed-by: Sheng Yang <sheng@xxxxxxxxxxxxxxx>
Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
---
drivers/pci/intel-iommu.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

Index: linux-2.6.35.y/drivers/pci/intel-iommu.c
===================================================================
--- linux-2.6.35.y.orig/drivers/pci/intel-iommu.c
+++ linux-2.6.35.y/drivers/pci/intel-iommu.c
@@ -3638,9 +3638,9 @@ static int intel_iommu_attach_device(str

pte = dmar_domain->pgd;
if (dma_pte_present(pte)) {
- free_pgtable_page(dmar_domain->pgd);
dmar_domain->pgd = (struct dma_pte *)
phys_to_virt(dma_pte_addr(pte));
+ free_pgtable_page(pte);
}
dmar_domain->agaw--;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/