linux/arch/powerpc
Roland Dreier a880e76233 powerpc: Avoid integer overflow in page_is_ram()
Commit 8b150478 ("ppc: make phys_mem_access_prot() work with pfns
instead of addresses") fixed page_is_ram() in arch/ppc to avoid overflow
for addresses above 4G on 32-bit kernels.  However arch/powerpc's
page_is_ram() is missing the same fix -- it computes a physical address
by doing pfn << PAGE_SHIFT, which overflows if pfn corresponds to a page
above 4G.

In particular this causes pages above 4G to be mapped with the wrong
caching attribute; for example many ppc440-based SoCs have PCI space
above 4G, and mmap()ing MMIO space may end up with a mapping that has
caching enabled.

Fix this by working with the pfn and avoiding the conversion to
physical address that causes the overflow.  This patch compares the
pfn to max_pfn, which is a semantic change from the old code -- that
code compared the physical address to high_memory, which corresponds
to max_low_pfn.  However, I think that was is another bug, since
highmem pages are still RAM.

Reported-by: vb <vb@vsbe.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2008-10-07 14:26:18 +11:00
..
boot Merge commit 'jwb/jwb-next' 2008-10-07 11:15:07 +11:00
configs Merge commit 'jwb/jwb-next' 2008-10-07 11:15:07 +11:00
include/asm Merge commit 'jwb/jwb-next' 2008-10-07 11:15:07 +11:00
kernel powerpc: Ignore generated vmlinux.lds in git 2008-10-07 14:26:18 +11:00
kvm KVM: ppc: fix invalidation of large guest pages 2008-07-27 12:02:05 +03:00
lib powerpc: New copy_4K_page() 2008-09-15 11:07:42 -07:00
math-emu powerpc/math-emu: Use kernel generic math-emu code 2008-10-01 08:40:07 -05:00
mm powerpc: Avoid integer overflow in page_is_ram() 2008-10-07 14:26:18 +11:00
oprofile powerpc: Expose PMCs & cache topology in sysfs on 32-bit 2008-08-20 16:34:58 +10:00
platforms Merge commit 'jwb/jwb-next' 2008-10-07 11:15:07 +11:00
sysdev Merge commit 'jwb/jwb-next' 2008-10-07 11:15:07 +11:00
xmon Merge branch 'linux-2.6' 2008-06-30 10:16:50 +10:00
Kconfig powerpc: Make the 64-bit kernel as a position-independent executable 2008-09-15 11:08:38 -07:00
Kconfig.debug powerpc: Split-out common MSI bitmap logic into msi_bitmap.c 2008-08-20 16:34:57 +10:00
Makefile powerpc: Enforce a non-spe kernel build even on broken compilers 2008-09-15 11:08:41 -07:00