Skip to content

Commit 1dd11e9

Browse files
ytcoodeakpm00
authored andcommitted
crash_core: fix the check for whether crashkernel is from high memory
If crash_base is equal to CRASH_ADDR_LOW_MAX, it also indicates that the crashkernel memory is allocated from high memory. However, the current check only considers the case where crash_base is greater than CRASH_ADDR_LOW_MAX. Fix it. The runtime effects is that crashkernel high memory is successfully reserved, whereas the crashkernel low memory is bypassed in this case, then kdump kernel bootup will fail because of no low memory under 4G. This patch also includes some minor cleanups. Link: https://lkml.kernel.org/r/20231209141438.77233-1-ytcoode@gmail.com Fixes: 0ab9716 ("crash_core: add generic function to do reservation") Signed-off-by: Yuntao Wang <ytcoode@gmail.com> Cc: Baoquan He <bhe@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Zhen Lei <thunder.leizhen@huawei.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 69f8ca8 commit 1dd11e9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

kernel/crash_core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static __initdata char *suffix_tbl[] = {
199199
* It returns 0 on success and -EINVAL on failure.
200200
*/
201201
static int __init parse_crashkernel_suffix(char *cmdline,
202-
unsigned long long *crash_size,
202+
unsigned long long *crash_size,
203203
const char *suffix)
204204
{
205205
char *cur = cmdline;
@@ -268,9 +268,9 @@ static int __init __parse_crashkernel(char *cmdline,
268268
unsigned long long *crash_base,
269269
const char *suffix)
270270
{
271-
char *first_colon, *first_space;
272-
char *ck_cmdline;
273-
char *name = "crashkernel=";
271+
char *first_colon, *first_space;
272+
char *ck_cmdline;
273+
char *name = "crashkernel=";
274274

275275
BUG_ON(!crash_size || !crash_base);
276276
*crash_size = 0;
@@ -440,7 +440,7 @@ void __init reserve_crashkernel_generic(char *cmdline,
440440
return;
441441
}
442442

443-
if ((crash_base > CRASH_ADDR_LOW_MAX) &&
443+
if ((crash_base >= CRASH_ADDR_LOW_MAX) &&
444444
crash_low_size && reserve_crashkernel_low(crash_low_size)) {
445445
memblock_phys_free(crash_base, crash_size);
446446
return;

0 commit comments

Comments
 (0)