projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
819723a
)
powerpc/32: Fix missing NULL pmd check in virt_to_kpte()
author
Christophe Leroy
<christophe.leroy@c-s.fr>
Sat, 7 Mar 2020 10:09:15 +0000
(10:09 +0000)
committer
Michael Ellerman
<mpe@ellerman.id.au>
Fri, 13 Mar 2020 10:13:05 +0000
(21:13 +1100)
Commit
2efc7c085f05
("powerpc/32: drop get_pteptr()"),
replaced get_pteptr() by virt_to_kpte(). But virt_to_kpte() lacks a
NULL pmd check and returns an invalid non NULL pointer when there
is no page table.
Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Fixes:
2efc7c085f05
("powerpc/32: drop get_pteptr()")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link:
https://lore.kernel.org/r/b1177cdfc6af74a3e277bba5d9e708c4b3315ebe.1583575707.git.christophe.leroy@c-s.fr
arch/powerpc/include/asm/pgtable.h
patch
|
blob
|
history
diff --git
a/arch/powerpc/include/asm/pgtable.h
b/arch/powerpc/include/asm/pgtable.h
index
b80bfd4
..
b1f1d53
100644
(file)
--- a/
arch/powerpc/include/asm/pgtable.h
+++ b/
arch/powerpc/include/asm/pgtable.h
@@
-54,7
+54,9
@@
static inline pmd_t *pmd_ptr_k(unsigned long va)
static inline pte_t *virt_to_kpte(unsigned long vaddr)
{
- return pte_offset_kernel(pmd_ptr_k(vaddr), vaddr);
+ pmd_t *pmd = pmd_ptr_k(vaddr);
+
+ return pmd_none(*pmd) ? NULL : pte_offset_kernel(pmd, vaddr);
}
#endif