aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/hugetlbpage-hash64.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>2018-09-20 23:39:45 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2018-10-03 15:39:59 +1000
commit75646c480fdeffbc246e9d45f29721ab5569f921 (patch)
treeed26173ab5f73c56889d0f61a70715e52acd679c /arch/powerpc/mm/hugetlbpage-hash64.c
parentpowerpc/mm/book3s: Check for pmd_large instead of pmd_trans_huge (diff)
downloadlinux-dev-75646c480fdeffbc246e9d45f29721ab5569f921.tar.xz
linux-dev-75646c480fdeffbc246e9d45f29721ab5569f921.zip
arch/powerpc/mm/hash: validate the pte entries before handling the hash fault
Make sure we are operating on THP and hugetlb entries in the respective hash fault handling routines. No functional change in this patch. If we walked the table wrongly before, we will retry the access. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/hugetlbpage-hash64.c')
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index b320f5097a06..2e6a8f9345d3 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -62,6 +62,10 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
new_pte |= _PAGE_DIRTY;
} while(!pte_xchg(ptep, __pte(old_pte), __pte(new_pte)));
+ /* Make sure this is a hugetlb entry */
+ if (old_pte & (H_PAGE_THP_HUGE | _PAGE_DEVMAP))
+ return 0;
+
rflags = htab_convert_pte_flags(new_pte);
if (unlikely(mmu_psize == MMU_PAGE_16G))
offset = PTRS_PER_PUD;