Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85ae11da authored by Christophe Leroy's avatar Christophe Leroy Committed by Greg Kroah-Hartman
Browse files

powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE



[ Upstream commit 5d9cea8a552ee122e21fbd5a3c5d4eb85f648e06 ]

On 8xx, PAGE_NONE is handled by setting _PAGE_NA instead of clearing
_PAGE_USER.

But then pte_user() returns 1 also for PAGE_NONE.

As _PAGE_NA prevent reads, add a specific version of pte_read()
that returns 0 when _PAGE_NA is set instead of always returning 1.

Fixes: 35175033 ("powerpc/mm: Introduce _PAGE_NA")
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/57bcfbe578e43123f9ed73e040229b80f1ad56ec.1695659959.git.christophe.leroy@csgroup.eu


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 077fdae9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -91,6 +91,13 @@ static inline pte_t pte_wrprotect(pte_t pte)

#define pte_wrprotect pte_wrprotect

static inline int pte_read(pte_t pte)
{
	return (pte_val(pte) & _PAGE_RO) != _PAGE_NA;
}

#define pte_read pte_read

static inline int pte_write(pte_t pte)
{
	return !(pte_val(pte) & _PAGE_RO);
+2 −0
Original line number Diff line number Diff line
@@ -45,7 +45,9 @@ static inline int pte_write(pte_t pte)
	return pte_val(pte) & _PAGE_RW;
}
#endif
#ifndef pte_read
static inline int pte_read(pte_t pte)		{ return 1; }
#endif
static inline int pte_dirty(pte_t pte)		{ return pte_val(pte) & _PAGE_DIRTY; }
static inline int pte_special(pte_t pte)	{ return pte_val(pte) & _PAGE_SPECIAL; }
static inline int pte_none(pte_t pte)		{ return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }