[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1434617314-18087-1-git-send-email-joro@8bytes.org>
Date: Thu, 18 Jun 2015 10:48:34 +0200
From: Joerg Roedel <joro@...tes.org>
To: iommu@...ts.linux-foundation.org
Cc: linux-kernel@...r.kernel.org, Joerg Roedel <jroedel@...e.de>,
stable@...nel.org
Subject: [PATCH] iommu/amd: Handle large pages correctly in free_pagetable
From: Joerg Roedel <jroedel@...e.de>
Make sure that we are skipping over large PTEs while walking
the page-table tree.
Cc: stable@...nel.org
Fixes: 5c34c403b723 ("iommu/amd: Fix memory leak in free_pagetable")
Signed-off-by: Joerg Roedel <jroedel@...e.de>
---
drivers/iommu/amd_iommu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 79892d2..45532ff 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1749,9 +1749,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 (IOMMU_PTE_MODE(pt[i]) == 0 || \
+ IOMMU_PTE_MODE(pt[i]) == 7) \
+ continue; \
+ \
p = (unsigned long)IOMMU_PTE_PAGE(pt[i]); \
FN(p); \
} \
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists