Skip to content

Commit

Permalink
powerpc: Fail ioremap() instead of silently ignoring flags when PAGE_…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
chleroy authored and mpe committed Oct 19, 2023
1 parent d3c0dfc commit c7263f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/powerpc/mm/ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c7263f1

Please sign in to comment.