Skip to content

Commit b6fd9e2

Browse files
committed
Merge tag 'fixes-2021-07-09' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock fix from Mike Rapoport: "This is a fix for the rework of ARM's pfn_valid() implementation merged during this merge window. Don't abuse pfn_valid() to check if pfn is in RAM The semantics of pfn_valid() is to check presence of the memory map for a PFN and not whether a PFN is in RAM. The memory map may be present for a hole in the physical memory and if such hole corresponds to an MMIO range, __arm_ioremap_pfn_caller() will produce a WARN() and fail. Use memblock_is_map_memory() instead of pfn_valid() to check if a PFN is in RAM or not" * tag 'fixes-2021-07-09' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: arm: ioremap: don't abuse pfn_valid() to check if pfn is in RAM
2 parents 20d5e57 + 024591f commit b6fd9e2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

arch/arm/mm/ioremap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/vmalloc.h>
2828
#include <linux/io.h>
2929
#include <linux/sizes.h>
30+
#include <linux/memblock.h>
3031

3132
#include <asm/cp15.h>
3233
#include <asm/cputype.h>
@@ -284,7 +285,8 @@ static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
284285
* Don't allow RAM to be mapped with mismatched attributes - this
285286
* causes problems with ARMv6+
286287
*/
287-
if (WARN_ON(pfn_valid(pfn) && mtype != MT_MEMORY_RW))
288+
if (WARN_ON(memblock_is_map_memory(PFN_PHYS(pfn)) &&
289+
mtype != MT_MEMORY_RW))
288290
return NULL;
289291

290292
area = get_vm_area_caller(size, VM_IOREMAP, caller);

0 commit comments

Comments
 (0)