[PATCH v8 11/11] LoongArch: kexec_file: Fix CMA segment placement retries

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Nov 12 06:21:54 PST 2026


> The file-based kexec system call places segments with kexec_add_buffer(),
> which takes them from CMA when kexec_alloc_contig() succeeds, to avoid
> copying the payload at kexec time.
> 
> When load_other_segments() cannot place the initrd, the segments of the
> attempt are dropped but their CMA pages are leaked.  Release them with
> kexec_rollback_segments() in the retry loop and in the error path of
> load_other_segments().
> 
> The loop makes progress by advancing buf_min past a segment placed by the
> walk.  kexec_alloc_contig() ignores buf_min, so once the pages of a CMA
> segment are released, the next attempt can get the same region again and
> the retry makes no progress.  Disable CMA for the retry.
> 
> A CMA segment can be anywhere in RAM, so moving buf_min to its end can
> [ ... ]
> Cc: Kees Cook <kees at kernel.org>
> Cc: stable at vger.kernel.org
> Link: https://sashiko.dev/#/patchset/20260729031235.2840255-1-ruanjinjie%40huawei.com
> Fixes: 55d990f0084c ("LoongArch: Add EFI binary support for kexec_file")
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112133418.4044428-1-ruanjinjie@huawei.com?part=11




More information about the kexec mailing list