When a PTE is modified, the POIndex must be masked off so that it can be 
modified.

Signed-off-by: Joey Gouly <joey.go...@arm.com>
Cc: Catalin Marinas <catalin.mari...@arm.com>
Cc: Will Deacon <w...@kernel.org>
---
 arch/arm64/include/asm/pgtable.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 7f7d9b1df4e5..6c57ebe8e349 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -820,7 +820,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
         */
        const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY |
                              PTE_PROT_NONE | PTE_VALID | PTE_WRITE | PTE_GP |
-                             PTE_ATTRINDX_MASK;
+                             PTE_ATTRINDX_MASK | PTE_PO_IDX_MASK;
+
        /* preserve the hardware dirty information */
        if (pte_hw_dirty(pte))
                pte = set_pte_bit(pte, __pgprot(PTE_DIRTY));
-- 
2.25.1

Reply via email to