summaryrefslogtreecommitdiff
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2023-09-25 21:31:36 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2023-10-19 09:12:46 +0300
commitc7263f156395d1f2a2142375a75b7b040686a07a (patch)
tree40bdaa55b2bd059df777f60e37b6884d7f6ea653 /arch/powerpc/mm
parentd3c0dfcfc95796701e82719722fd997ec5256013 (diff)
downloadlinux-c7263f156395d1f2a2142375a75b7b040686a07a.tar.xz
powerpc: Fail ioremap() instead of silently ignoring flags when PAGE_USER is set
Calling ioremap() with _PAGE_USER (or _PAGE_PRIVILEDGE unset) is wrong. Loudly fail the call to ioremap() instead of blindly clearing the flags. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/b6dd5485ad00d2aafd2bb9b7c2c4eac3ebf2cdaf.1695659959.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/ioremap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c
index d5159f205380..7823c38f09de 100644
--- a/arch/powerpc/mm/ioremap.c
+++ b/arch/powerpc/mm/ioremap.c
@@ -51,7 +51,8 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
pte = pte_mkdirty(pte);
/* we don't want to let _PAGE_USER leak out */
- pte = pte_mkprivileged(pte);
+ if (WARN_ON(pte_user(pte)))
+ return NULL;
if (iowa_is_active())
return iowa_ioremap(addr, size, pte_pgprot(pte), caller);