]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/nohash: fix pte_access_permitted()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 21 Aug 2018 13:03:23 +0000 (13:03 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 23 Aug 2018 02:15:58 +0000 (12:15 +1000)
commit1378cc1b193e803b552f86dd62b12becf3aaaf4e
treeff4a4ce016185ec171cd06466b8dec7b039bb137
parent699db2b1476664734f1cb03bbccb6acf8950fe03
powerpc/nohash: fix pte_access_permitted()

Commit c2c9e6911fc39 ("powerpc/mm: Add proper pte access check helper
for other platforms") replaced generic pte_access_permitted() by an
arch specific one.

The generic one is defined as
(pte_present(pte) && (!(write) || pte_write(pte)))

The arch specific one is open coded checking that _PAGE_USER and
_PAGE_WRITE (_PAGE_RW) flags are set, but lacking to check that
_PAGE_RO and _PAGE_PRIVILEGED are unset, leading to a useless test
on targets like the 8xx which defines _PAGE_RW and _PAGE_USER as 0.

Commit c3e18200085ec ("powerpc/mm/hugetlb: Use pte_access_permitted
for hugetlb access check") replaced some tests performed with
pte helpers by a call to pte_access_permitted(), leading to the same
issue.

This patch rewrites powerpc/nohash pte_access_permitted()
using pte helpers.

Fixes: c2c9e6911fc39 ("powerpc/mm: Add proper pte access check helper for other platforms")
Fixes: c3e18200085ec ("powerpc/mm/hugetlb: Use pte_access_permitted for hugetlb access check")
Cc: stable@vger.kernel.org # v4.15+
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/nohash/pgtable.h