linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix for the arm64 kern_addr_valid() function
@ 2014-04-15 17:53 Dave Anderson
  2014-04-16  7:51 ` Will Deacon
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Anderson @ 2014-04-15 17:53 UTC (permalink / raw)
  To: linux-arm-kernel

 Fix for the arm64 kern_addr_valid() function to recognize
 virtual addresses in the kernel logical memory map.  The
 function fails as written because it does not check whether
 the addresses in that region are mapped at the pmd level to
 2MB or 512MB pages, continues the page table walk to the
 pte level, and issues a garbage value to pfn_valid().

 Tested on 4K-page and 64K-page kernels.

Signed-off-by: Dave Anderson <anderson@redhat.com>
---
 arch/arm64/mm/mmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 6b7e895..0a472c4 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -374,6 +374,9 @@ int kern_addr_valid(unsigned long addr)
 	if (pmd_none(*pmd))
 		return 0;
 
+	if (pmd_sect(*pmd))
+		return pfn_valid(pmd_pfn(*pmd));
+
 	pte = pte_offset_kernel(pmd, addr);
 	if (pte_none(*pte))
 		return 0;
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-29 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 17:53 [PATCH] Fix for the arm64 kern_addr_valid() function Dave Anderson
2014-04-16  7:51 ` Will Deacon
2014-04-16 13:35   ` Dave Anderson
2014-04-29 14:25   ` Catalin Marinas
2014-04-29 14:34     ` Don Dutile
2014-04-29 15:00     ` Will Deacon

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).