mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 15:56:18 +07:00
x86/setup/crash: Check memblock_reserve() retval
memblock_reserve() can fail but the crashkernel reservation code doesn't check that and this can lead the user into believing that the crashkernel region was actually reserved. Make sure we check that return value and we exit early with a failure message in the error case. Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Dave Young <dyoung@redhat.com> Reviewed-by: Joerg Roedel <jroedel@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mark Salter <msalter@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: WANG Chao <chaowang@redhat.com> Cc: jerry_hoemann@hp.com Link: http://lkml.kernel.org/r/1445246268-26285-7-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
f56d55781c
commit
6f3760570e
@ -531,7 +531,11 @@ static int __init reserve_crashkernel_low(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memblock_reserve(low_base, low_size);
|
||||
ret = memblock_reserve(low_base, low_size);
|
||||
if (ret) {
|
||||
pr_err("%s: Error reserving crashkernel low memblock.\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pr_info("Reserving %ldMB of low memory at %ldMB for crashkernel (System low RAM: %ldMB)\n",
|
||||
(unsigned long)(low_size >> 20),
|
||||
@ -589,7 +593,11 @@ static void __init reserve_crashkernel(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
memblock_reserve(crash_base, crash_size);
|
||||
ret = memblock_reserve(crash_base, crash_size);
|
||||
if (ret) {
|
||||
pr_err("%s: Error reserving crashkernel memblock.\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
|
||||
memblock_free(crash_base, crash_size);
|
||||
|
Loading…
Reference in New Issue
Block a user