]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
intel-iommu: Fix use after release during device attach
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 2 Nov 2010 07:05:51 +0000 (08:05 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 May 2011 16:19:35 +0000 (09:19 -0700)
commit 7a6610139a1e1d9297dd1c5d178022eac36839cb upstream.

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

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/intel-iommu.c

index 4789f8e8bf7ad91cae0b0a1043349ac96ea5fa64..35463ddf10a1605dec3f0d64d518e31518bf101c 100644 (file)
@@ -3627,9 +3627,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
 
                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--;
        }