Commit 7a661013 authored by Jan Kiszka's avatar Jan Kiszka Committed by David Woodhouse

intel-iommu: Fix use after release during device attach

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

Cc: stable@kernel.org
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: default avatarSheng Yang <sheng@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent e78bf5e6
...@@ -3627,9 +3627,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, ...@@ -3627,9 +3627,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
pte = dmar_domain->pgd; pte = dmar_domain->pgd;
if (dma_pte_present(pte)) { if (dma_pte_present(pte)) {
free_pgtable_page(dmar_domain->pgd);
dmar_domain->pgd = (struct dma_pte *) dmar_domain->pgd = (struct dma_pte *)
phys_to_virt(dma_pte_addr(pte)); phys_to_virt(dma_pte_addr(pte));
free_pgtable_page(pte);
} }
dmar_domain->agaw--; dmar_domain->agaw--;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment