Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934234AbbGHHxI (ORCPT ); Wed, 8 Jul 2015 03:53:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43299 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933994AbbGHHhB (ORCPT ); Wed, 8 Jul 2015 03:37:01 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel Subject: [PATCH 4.1 30/56] iommu/amd: Handle large pages correctly in free_pagetable Date: Wed, 8 Jul 2015 00:35:19 -0700 Message-Id: <20150708073239.477457249@linuxfoundation.org> X-Mailer: git-send-email 2.4.5 In-Reply-To: <20150708073237.780280770@linuxfoundation.org> References: <20150708073237.780280770@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1284 Lines: 44 4.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joerg Roedel 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 Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/amd_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -1869,9 +1869,15 @@ static void free_pt_##LVL (unsigned long 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); \ } \ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/