]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: Call early_init_fdt_scan_reserved_mem() earlier
authorHuacai Chen <chenhuacai@loongson.cn>
Fri, 23 Feb 2024 06:36:31 +0000 (14:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:58 +0000 (13:34 +0100)
commitea459e6926f00418dd2967c091c4c844e7b2a8ee
treee11afb222e349f2f63e539a86f4495fdc9b87f0a
parent50297906f81c156674af46d05ad889f0a567eb7a
LoongArch: Call early_init_fdt_scan_reserved_mem() earlier

commit 9fa304b9f8ec440e614af6d35826110c633c4074 upstream.

The unflatten_and_copy_device_tree() function contains a call to
memblock_alloc(). This means that memblock is allocating memory before
any of the reserved memory regions are set aside in the arch_mem_init()
function which calls early_init_fdt_scan_reserved_mem(). Therefore,
there is a possibility for memblock to allocate from any of the
reserved memory regions.

Hence, move the call to early_init_fdt_scan_reserved_mem() to be earlier
in the init sequence, so that the reserved memory regions are set aside
before any allocations are done using memblock.

Cc: stable@vger.kernel.org
Fixes: 88d4d957edc707e ("LoongArch: Add FDT booting support from efi system table")
Signed-off-by: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/kernel/setup.c