Commit 3d7b0e41 authored by David Woodhouse's avatar David Woodhouse

intel-iommu: Don't free too much in dma_pte_free_pagetable()

The loop condition was wrong -- we should free a PMD only if its
_entire_ range is within the range we're intending to clear. The
early-termination condition was right, but not the loop.
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 1bf20f0d
...@@ -815,7 +815,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain, ...@@ -815,7 +815,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
if (tmp + level_size(level) - 1 > last_pfn) if (tmp + level_size(level) - 1 > last_pfn)
return; return;
while (tmp <= last_pfn) { while (tmp + level_size(level) - 1 <= last_pfn) {
pte = dma_pfn_level_pte(domain, tmp, level); pte = dma_pfn_level_pte(domain, tmp, level);
if (pte) { if (pte) {
free_pgtable_page( free_pgtable_page(
......
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