intel-iommu: Don't free too much in dma_pte_free_pagetable()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 30 Jun 2009 02:38:09 +0000 (03:38 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 30 Jun 2009 02:57:38 +0000 (03:57 +0100)
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: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c

index 40ce5a0..35bdd2a 100644 (file)
@@ -815,7 +815,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
                if (tmp + level_size(level) - 1 > last_pfn)
                        return;
 
-               while (tmp <= last_pfn) {
+               while (tmp + level_size(level) - 1 <= last_pfn) {
                        pte = dma_pfn_level_pte(domain, tmp, level);
                        if (pte) {
                                free_pgtable_page(