]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Fail remap_4k_pfn() if PFN doesn't fit inside PTE
authorMadhusudanan Kandasamy <kmadhu@linux.vnet.ibm.com>
Thu, 10 Jul 2014 15:15:13 +0000 (20:45 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 5 Aug 2014 06:34:06 +0000 (16:34 +1000)
commitb9204a911dc9f071c91632b981879c46ea5c8405
tree8325d4ab23b055571595fb2b1434d7378201dfca
parentaa5aad2ef0b40f8c22e57f2c56880755ec24ddd3
powerpc: Fail remap_4k_pfn() if PFN doesn't fit inside PTE

remap_4k_pfn() silently truncates upper bits of input 4K PFN
if it cannot be contained in PTE. This leads invalid memory mapping and could
result in a system crash when the memory is accessed. This patch fails
remap_4k_pfn() and returns -EINVAL if the input 4K PFN cannot be contained in
PTE.

V3 : Added parentheses to protect 'pfn' and entire macro as suggested by Brian.
V2 : Rewritten to avoid helper function as suggested by Stephen Rothwell.

Signed-off-by: Madhusudanan Kandasamy <kmadhu@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/pte-hash64-64k.h