Skip to content

Commit 9a8ef14

Browse files
MJNowakowskigregkh
authored andcommitted
MIPS: init: Ensure reserved memory regions are not added to bootmem
[ Upstream commit e89ef66d7682f031f026eee6bba03c8c2248d2a9 ] Memories managed through boot_mem_map are generally expected to define non-crossing areas. However, if part of a larger memory block is marked as reserved, it would still be added to bootmem allocator as an available block and could end up being overwritten by the allocator. Prevent this by explicitly marking the memory as reserved it if exists in the range used by bootmem allocator. Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14608/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 034347a commit 9a8ef14

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

arch/mips/kernel/setup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,10 @@ static void __init bootmem_init(void)
506506
continue;
507507
default:
508508
/* Not usable memory */
509+
if (start > min_low_pfn && end < max_low_pfn)
510+
reserve_bootmem(boot_mem_map.map[i].addr,
511+
boot_mem_map.map[i].size,
512+
BOOTMEM_DEFAULT);
509513
continue;
510514
}
511515

0 commit comments

Comments
 (0)