diff options
| author | Marek Vasut <marek.vasut+renesas@mailbox.org> | 2025-11-20 05:15:30 +0100 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-12-05 16:24:56 -0600 |
| commit | 717f8ded395fc0369620c3935980642fed909345 (patch) | |
| tree | 10d0494df576292c72a0b46de37a1def1e616f39 | |
| parent | d3ddbc1cf8ed7ed3fb63620c93001e55a1f480cb (diff) | |
boot: Check noffset before use
If noffset is negative, do not pass it to fit_get_name() and then further to
libfdt, this will crash sandbox with SIGSEGV because libfdt can not handle
negative node offsets without full tree check, which U-Boot inhibits to keep
size lower.
Instead, always check noffset before use, and if the return value indicates
failure, exit right away.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
| -rw-r--r-- | boot/image-fit.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/boot/image-fit.c b/boot/image-fit.c index fce3a320eac..f47f37471c0 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -2142,7 +2142,6 @@ int fit_image_load(struct bootm_headers *images, ulong addr, noffset = fit_conf_get_prop_node(fit, cfg_noffset, prop_name, image_ph_phase(ph_type)); - fit_uname = fit_get_name(fit, noffset, NULL); } if (noffset < 0) { printf("Could not find subimage node type '%s'\n", prop_name); @@ -2150,6 +2149,9 @@ int fit_image_load(struct bootm_headers *images, ulong addr, return -ENOENT; } + if (!fit_uname) + fit_uname = fit_get_name(fit, noffset, NULL); + printf(" Trying '%s' %s subimage\n", fit_uname, prop_name); ret = fit_image_select(fit, noffset, images->verify); |
