From: David Gibson <david@gibson.dropbear.id.au>

Due to a misunderstanding of pmd_offset() the PPC64 hugepage code could end
up looking at bogus pages as if they were PMD pages.


---

 25-akpm/arch/ppc64/mm/hugetlbpage.c |    3 +++
 1 files changed, 3 insertions(+)

diff -puN arch/ppc64/mm/hugetlbpage.c~ppc64-hugetlbpage-fix arch/ppc64/mm/hugetlbpage.c
--- 25/arch/ppc64/mm/hugetlbpage.c~ppc64-hugetlbpage-fix	2004-03-31 22:54:15.235369472 -0800
+++ 25-akpm/arch/ppc64/mm/hugetlbpage.c	2004-03-31 22:54:15.239368864 -0800
@@ -190,6 +190,9 @@ static hugepte_t *hugepte_offset(struct 
 	BUG_ON(!in_hugepage_area(mm->context, addr));
 
 	pgd = pgd_offset(mm, addr);
+	if (pgd_none(*pgd))
+		return NULL;
+
 	pmd = pmd_offset(pgd, addr);
 
 	/* We shouldn't find a (normal) PTE page pointer here */

_