arm64: check for upper PAGE_SHIFT bits in pfn_valid()
authorGreg Hackmann <ghackmann@google.com>
Thu, 28 Aug 2014 21:00:10 +0000 (14:00 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:54:03 +0000 (13:54 -0800)
commitc6a9c8e51b188d049496643db2cfbb67df65190c
tree823ad677a82987ab1166aa36811436a6c180a841
parent487e34bfedac629ad8af0471ab72ab553871e810
arm64: check for upper PAGE_SHIFT bits in pfn_valid()

pfn_valid() returns a false positive when the lower (64 - PAGE_SHIFT)
bits match a valid pfn but some of the upper bits are set.  This caused
a kernel panic in kpageflags_read() when a userspace utility parsed
/proc/*/pagemap, neglected to discard the upper flag bits, and tried to
lseek()+read() from the corresponding offset in /proc/kpageflags.

A valid pfn will never have the upper PAGE_SHIFT bits set, so simply
check for this before passing the pfn to memblock_is_memory().

Change-Id: Ief5d8cd4dd93cbecd545a634a8d5885865cb5970
Signed-off-by: Greg Hackmann <ghackmann@google.com>
arch/arm64/mm/init.c