[PATCH v2] riscv: Fix a NULL pointer reference in machine_kexec_prepare

Pratyush Yadav pratyush at kernel.org
Mon Jun 29 04:13:24 PDT 2026


On Sun, Jun 28 2026, Tao Liu wrote:

> A NULL pointer reference issue is noticed in riscv's machine_kexec_prepare,
> where image->segment[i].buf might be NULL and copied unchecked.
>
> The NULL buf comes from security/integrity/ima/ima_kexec.c:
> ima_add_kexec_buffer(), where kbuf is added by kexec_add_buffer(),
> but kbuf.buffer is NULL.
>
> Fix this by simply adding a check before copy.
>
> Acked-by: Baoquan He <bhe at redhat.com>
> Signed-off-by: Tao Liu <ltao at redhat.com>

Acked-by: Pratyush Yadav <pratyush at kernel.org>

[...]

-- 
Regards,
Pratyush Yadav



More information about the linux-riscv mailing list