Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1250494
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 6/8] x86/setup/crash: Check memblock_reserve() retval |
| Date | 2015-10-19 11:20 +0200 |
| Message-ID | <qleLN-8ro-37@gated-at.bofh.it> (permalink) |
| References | <qleLL-8ro-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Borislav Petkov <bp@suse.de>
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.
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: Ingo Molnar <mingo@kernel.org>
Cc: jerry_hoemann@hp.com
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Juergen Gross <jgross@suse.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: WANG Chao <chaowang@redhat.com>
Cc: x86-ml <x86@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/setup.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d4788719a1e2..3f75297d5fd0 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -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);
--
2.3.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] tip-queue 2015-10-19 Borislav Petkov <bp@alien8.de> - 2015-10-19 11:20 +0200
[PATCH 8/8] x86/mce: Fix thermal throttling reporting after kexec Borislav Petkov <bp@alien8.de> - 2015-10-19 11:20 +0200
[tip:ras/core] x86/mce: Fix thermal throttling reporting after kexec tip-bot for Andi Kleen <tipbot@zytor.com> - 2015-10-21 12:10 +0200
[PATCH 6/8] x86/setup/crash: Check memblock_reserve() retval Borislav Petkov <bp@alien8.de> - 2015-10-19 11:20 +0200
[tip:ras/core] x86/setup/crash: Check memblock_reserve() retval tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-10-21 12:10 +0200
[PATCH 3/8] x86/setup: Cleanup crashkernel reservation functions Borislav Petkov <bp@alien8.de> - 2015-10-19 11:30 +0200
[tip:ras/core] x86/setup: Cleanup crashkernel reservation functions tip-bot for Borislav Petkov <tipbot@zytor.com> - 2015-10-21 12:10 +0200
[PATCH 2/8] x86/amd_nb, EDAC: Rename amd_get_node_id() Borislav Petkov <bp@alien8.de> - 2015-10-19 11:30 +0200
[tip:ras/core] x86/amd_nb, EDAC: Rename amd_get_node_id() tip-bot for Aravind Gopalakrishnan <tipbot@zytor.com> - 2015-10-21 12:10 +0200
csiph-web