From: Greg Hackmann <ghackmann@android.com>
To: linux-arm-kernel@lists.infradead.org
Cc: kernel-team@android.com, Greg Hackmann <ghackmann@google.com>,
stable@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
Kees Cook <keescook@chromium.org>,
Vladimir Murzin <vladimir.murzin@arm.com>,
Philip Derrin <philip@cog.systems>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
Jinbum Park <jinb.park7@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] arm: mm: check for upper PAGE_SHIFT bits in pfn_valid()
Date: Wed, 15 Aug 2018 12:51:22 -0700 [thread overview]
Message-ID: <20180815195123.187373-2-ghackmann@google.com> (raw)
In-Reply-To: <20180815195123.187373-1-ghackmann@google.com>
ARM's pfn_valid() has a similar shifting bug to the ARM64 bug fixed in
the previous patch. This only affects non-LPAE kernels, since LPAE
kernels will promote to 64 bits inside __pfn_to_phys().
Fixes: 5e6f6aa1c243 ("memblock/arm: pfn_valid uses memblock_is_memory()")
Cc: stable@vger.kernel.org
Signed-off-by: Greg Hackmann <ghackmann@google.com>
---
arch/arm/mm/init.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 0cc8e04295a4..bee1f2e4ecf3 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -196,7 +196,11 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
#ifdef CONFIG_HAVE_ARCH_PFN_VALID
int pfn_valid(unsigned long pfn)
{
- return memblock_is_map_memory(__pfn_to_phys(pfn));
+ phys_addr_t addr = __pfn_to_phys(pfn);
+
+ if (__phys_to_pfn(addr) != pfn)
+ return 0;
+ return memblock_is_map_memory(addr);
}
EXPORT_SYMBOL(pfn_valid);
#endif
--
2.18.0.865.gffc8e1a3cd6-goog
prev parent reply other threads:[~2018-08-15 19:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 19:51 [PATCH v2 1/2] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() Greg Hackmann
2018-08-15 19:51 ` Greg Hackmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180815195123.187373-2-ghackmann@google.com \
--to=ghackmann@android.com \
--cc=ghackmann@google.com \
--cc=jinb.park7@gmail.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nicolas.pitre@linaro.org \
--cc=philip@cog.systems \
--cc=rostedt@goodmis.org \
--cc=stable@vger.kernel.org \
--cc=vladimir.murzin@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).