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: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
e78bf5e6cb
commit
7a6610139a
|
@ -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--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue