From: Christophe Leroy Date: Mon, 15 Jun 2020 12:57:57 +0000 (+0000) Subject: mm/gup: Use huge_ptep_get() in gup_hugepte() X-Git-Tag: Ubuntu-5.13.0-19.19~5703^2~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=55ca22633a9faa34c6a61d99433f9cc8e28dd7cc;p=mirror_ubuntu-jammy-kernel.git mm/gup: Use huge_ptep_get() in gup_hugepte() gup_hugepte() reads hugepage table entries, it can't read them directly, huge_ptep_get() must be used. Fixes: 9e343b467c70 ("READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses") Signed-off-by: Christophe Leroy Acked-by: Will Deacon Acked-by: Peter Zijlstra (Intel) Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/ffc3714334c3bfaca6f13788ad039e8759ae413f.1592225558.git.christophe.leroy@csgroup.eu --- diff --git a/mm/gup.c b/mm/gup.c index de9e36262ccb..761df4944ef5 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2425,7 +2425,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, if (pte_end < end) end = pte_end; - pte = READ_ONCE(*ptep); + pte = huge_ptep_get(ptep); if (!pte_access_permitted(pte, flags & FOLL_WRITE)) return 0;