[PATCH] kho: fix error handling in kho_add_subtree()

Andrew Morton akpm at linux-foundation.org
Thu Apr 9 15:08:02 PDT 2026


On Tue, 07 Apr 2026 10:01:47 -0700 Breno Leitao <leitao at debian.org> wrote:

> Fix two error handling issues in kho_add_subtree(), where it doesn't
> handle the error path correctly.
> 
> 1. If fdt_setprop() fails after the subnode has been created, the
>    subnode is not removed. This leaves an incomplete node in the FDT
>    (missing "preserved-data" or "blob-size" properties).
> 
> 2. The fdt_setprop() return value (an FDT error code) is stored
>    directly in err and returned to the caller, which expects -errno.
> 
> Fix both by storing fdt_setprop() results in fdt_err, jumping to a new
> out_del_node label that removes the subnode on failure, and only setting
> err = 0 on the success path, otherwise returning -ENOMEM (instead of
> FDT_ERR_ errors that would come from fdt_setprop).
> 
> Fixes: 3dc92c311498 ("kexec: add Kexec HandOver (KHO) generation helpers")

v6.16.

> Suggested-by: Pratyush Yadav <pratyush at kernel.org>
> Signed-off-by: Breno Leitao <leitao at debian.org>
> ---
>  kernel/liveupdate/kexec_handover.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)

Do -stable kernels want this?

Changelog is missing a description of userspace-visible effects, So I
(and others) can't tell!



More information about the kexec mailing list