Re: [PATCH 1/3] crash: Fix memory reserve dead loop bug in reserve_crashkernel_generic()

Linus Walleij
2024-08-05T07:16:09Z

On Mon, Jul 8, 2024 at 3:30 PM Jinjie Ruan <ruanjinjie@huawei.com> wrote:

> If the platform do not support memory above 4G, such as 32 bit arch,
> and CRASH_ADDR_LOW_MAX is equal to CRASH_ADDR_HIGH_MAX, the high
> crash kernel memory reservation is meaningless and it will cause
> dead loop and system stall:
>
> -> reserve_crashkernel_generic() and high is true
> -> memblock_phys_alloc_range() fail and return 0
> -> search_end = CRASH_ADDR_LOW_MAX(same as CRASH_ADDR_HIGH_MAX)
> -> call memblock_phys_alloc_range() again and fail agin.
> -> search_end == CRASH_ADDR_HIGH_MAX satisfy again
> ......
>
> However, the current check only considers the case where
> CRASH_ADDR_HIGH_MAX is greater than CRASH_ADDR_LOW_MAX. Fix it.
>
> Fixes: 0ab97169aa05 ("crash_core: add generic function to do reservation")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Looks good to me:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij