[PATCH] arm64: kexec: Add support for crashkernel CMA reservation

Breno Leitao leitao at debian.org
Fri Jan 23 01:29:53 PST 2026


Hello Jinjie,

On Fri, Jan 23, 2026 at 03:48:20PM +0800, Jinjie Ruan wrote:
> Extend crashkernel CMA reservation support to arm64.

This is awesome. I was waiting for this patch! Thanks for working on it.

> @@ -75,6 +81,13 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
>  			goto out;
>  	}
>  
> +	for (i = 0; i < crashk_cma_cnt; ++i) {
> +		ret = crash_exclude_mem_range(cmem, crashk_cma_ranges[i].start,
> +					      crashk_cma_ranges[i].end);
> +		if (ret)
> +			return ret;

Don't you want to "goto out" here, given you want to free cmem.

earlirer in this function, it does:

	cmem = kmalloc(struct_size(cmem, ranges, nr_ranges), GFP_KERNEL);

you probably want to free it before returning an error, given
prepare_elf_headers() will return an error, which will fail load image,
causing the memory leak for cmem above.



More information about the linux-arm-kernel mailing list