summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-06-18 10:48:34 +0200
committerSasha Levin <sasha.levin@oracle.com>2015-07-13 08:50:07 -0400
commitf4edd6d5e39a5340b6c01dce0fbd5e2d61427973 (patch)
treea9fad1654cf8495da8b209edcaa5df733ff87c8a /drivers
parent8729369484a2c655c5f351ad507e6bf099bc8f5e (diff)
downloadlinux-stable-f4edd6d5e39a5340b6c01dce0fbd5e2d61427973.tar.gz
linux-stable-f4edd6d5e39a5340b6c01dce0fbd5e2d61427973.tar.bz2
linux-stable-f4edd6d5e39a5340b6c01dce0fbd5e2d61427973.zip
iommu/amd: Handle large pages correctly in free_pagetable
[ Upstream commit 0b3fff54bc01e8e6064d222a33e6fa7adabd94cd ] 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> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers')
-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 505a9adac2d5..fab0ea1a46d1 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1870,9 +1870,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); \
} \