Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc32: Fix pte_offset_kernel() to return NULL for bad pages

The fixmap related functions try to map kernel pages that are
already mapped through Large TLBs. pte_offset_kernel() has to
return NULL for LTLBs, otherwise the caller will try to access
level 2 table which doesn't exist

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <oss@buserror.net>

authored by

Christophe Leroy and committed by
Scott Wood
be00ed72 516d9189

+2 -1
+2 -1
arch/powerpc/include/asm/nohash/32/pgtable.h
··· 309 309 #define pte_index(address) \ 310 310 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 311 311 #define pte_offset_kernel(dir, addr) \ 312 - ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) 312 + (pmd_bad(*(dir)) ? NULL : (pte_t *)pmd_page_vaddr(*(dir)) + \ 313 + pte_index(addr)) 313 314 #define pte_offset_map(dir, addr) \ 314 315 ((pte_t *) kmap_atomic(pmd_page(*(dir))) + pte_index(addr)) 315 316 #define pte_unmap(pte) kunmap_atomic(pte)