summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-06-18 10:48:34 +0200
committerJoerg Roedel <jroedel@suse.de>2015-06-19 17:17:34 +0200
commit0b3fff54bc01e8e6064d222a33e6fa7adabd94cd (patch)
tree1fba9507bd5740d54693a18a53664b5f2d1fd67a /drivers/iommu
parente6aabee05f41c9d18e0b92194819edd84f352ac9 (diff)
downloadlinux-0b3fff54bc01e8e6064d222a33e6fa7adabd94cd.tar.bz2
iommu/amd: Handle large pages correctly in free_pagetable
Make sure that we are skipping over large PTEs while walking the page-table tree. Cc: stable@kernel.org Fixes: 5c34c403b723 ("iommu/amd: Fix memory leak in free_pagetable") Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 4dfadcfed34a..31e90c472c76 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1866,9 +1866,15 @@ static void free_pt_##LVL (unsigned long __pt) \
pt = (u64 *)__pt; \
\
for (i = 0; i < 512; ++i) { \
+ /* PTE present? */ \
if (!IOMMU_PTE_PRESENT(pt[i])) \
continue; \
\
+ /* Large PTE? */ \
+ if (PM_PTE_LEVEL(pt[i]) == 0 || \
+ PM_PTE_LEVEL(pt[i]) == 7) \
+ continue; \
+ \
p = (unsigned long)IOMMU_PTE_PAGE(pt[i]); \
FN(p); \
} \