intel-iommu: Don't keep freeing page zero in dma_pte_free_pagetable()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 2 Jul 2009 11:02:34 +0000 (12:02 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 2 Jul 2009 11:02:38 +0000 (12:02 +0100)
Check dma_pte_present() and only free the page if there _is_ one.
Kind of surprising that there was no warning about this.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c

index dcf0295a9b602f3efd18e28989409720c065f44a..53075424a4349c0efdbbb24a22ba0f7226aa21d3 100644 (file)
@@ -826,8 +826,10 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain,
                                continue;
                        }
                        do {
-                               free_pgtable_page(phys_to_virt(dma_pte_addr(pte)));
-                               dma_clear_pte(pte);
+                               if (dma_pte_present(pte)) {
+                                       free_pgtable_page(phys_to_virt(dma_pte_addr(pte)));
+                                       dma_clear_pte(pte);
+                               }
                                pte++;
                                tmp += level_size(level);
                        } while (!first_pte_in_page(pte) &&