powerpc/fadump: Account for memory_limit while reserving memory
authorHari Bathini <hbathini@linux.ibm.com>
Wed, 27 May 2020 09:44:35 +0000 (15:14 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 2 Jun 2020 10:59:05 +0000 (20:59 +1000)
If the memory chunk found for reserving memory overshoots the memory
limit imposed, do not proceed with reserving memory. Default behavior
was this until commit 140777a3d8df ("powerpc/fadump: consider reserved
ranges while reserving memory") changed it unwittingly.

Fixes: 140777a3d8df ("powerpc/fadump: consider reserved ranges while reserving memory")
Cc: stable@vger.kernel.org
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/159057266320.22331.6571453892066907320.stgit@hbathini.in.ibm.com
arch/powerpc/kernel/fadump.c

index 63aac8b5f23326245c96dac57f9bd2a953f06e92..78ab9a6ee6acccfecbc0cd1897634840cdcb630b 100644 (file)
@@ -603,7 +603,7 @@ int __init fadump_reserve_mem(void)
                 */
                base = fadump_locate_reserve_mem(base, size);
 
-               if (!base) {
+               if (!base || (base + size > mem_boundary)) {
                        pr_err("Failed to find memory chunk for reservation!\n");
                        goto error_out;
                }