Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Handle large pages correctly in free_pagetable
@ 2015-06-18  8:48 Joerg Roedel
  0 siblings, 0 replies; only message in thread
From: Joerg Roedel @ 2015-06-18  8:48 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: Joerg Roedel, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	stable-DgEjT+Ai2ygdnm+yROfE0A

From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>

Make sure that we are skipping over large PTEs while walking
the page-table tree.

Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Fixes: 5c34c403b723 ("iommu/amd: Fix memory leak in free_pagetable")
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-18  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-18  8:48 [PATCH] iommu/amd: Handle large pages correctly in free_pagetable Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox