diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-06-18 10:48:34 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-10 10:37:57 -0700 |
commit | 2ef6b2a063acda7d334ee42f60670f21f774c200 (patch) | |
tree | e8a03ec101d825da21aa6a671a2be98fabbbe1bc | |
parent | e41a1e6577d29886470e21875e8d7daa3102cf90 (diff) | |
download | lwn-2ef6b2a063acda7d334ee42f60670f21f774c200.tar.gz lwn-2ef6b2a063acda7d334ee42f60670f21f774c200.zip |
iommu/amd: Handle large pages correctly in free_pagetable
commit 0b3fff54bc01e8e6064d222a33e6fa7adabd94cd upstream.
Make sure that we are skipping over large PTEs while walking
the page-table tree.
Fixes: 5c34c403b723 ("iommu/amd: Fix memory leak in free_pagetable")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/iommu/amd_iommu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 9cbef59d404a..935974090aa0 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -1922,9 +1922,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); \ } \ |