ptep_try_set() installs the new entry with try_cmpxchg() but, unlike __set_pte(), never calls __set_pte_complete(). On arm64, installing a valid kernel PTE requires barriers afterward so a subsequent access observes it. Without them the access can fault instead of reaching the freshly installed page. Call __set_pte_complete() after a successful cmpxchg, mirroring __set_pte(). Fixes: 258df8fce42f ("mm: Add ptep_try_set() for lockless empty-slot installs") Suggested-by: Catalin Marinas Link: https://lore.kernel.org/all/aiRFcz78QTZdIHHB@arm.com/ Signed-off-by: Tejun Heo --- arch/arm64/include/asm/pgtable.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 3ce0f2a6cab6..dc8525431273 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1838,7 +1838,11 @@ static inline bool ptep_try_set(pte_t *ptep, pte_t new_pte) { pteval_t old = 0; - return try_cmpxchg(&pte_val(*ptep), &old, pte_val(new_pte)); + if (!try_cmpxchg(&pte_val(*ptep), &old, pte_val(new_pte))) + return false; + + __set_pte_complete(new_pte); + return true; } #define ptep_try_set ptep_try_set -- 2.51.1