From: Carlo Caione <ccaione@baylibre.com>
To: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: u-boot@lists.u-boot-project.org, Tom Rini <trini@konsulko.com>,
Simon Glass <sjg@chromium.org>,
Lukasz Majewski <lukma@nabladev.com>,
Marek Vasut <marek.vasut+usb@mailbox.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
York Sun <york.sun@nxp.com>,
Francesco Valla <francesco@valla.it>,
Anton Ivanov <anton@binarly.io>,
Aristo Chen <aristo.chen@canonical.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Marek Vasut <marex@nabladev.com>,
Michal Simek <michal.simek@amd.com>, Peng Fan <peng.fan@nxp.com>,
Daniel Golle <daniel@makrotopia.org>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Sam Day <me@samcday.com>, Pengpeng Hou <pengpeng@iscas.ac.cn>,
Alexey Charkov <alchark@flipper.net>,
Kevin Hilman <khilman@baylibre.com>
Subject: Re: [PATCH 1/6] spl: fit: reject failures loading an explicitly requested FDT
Date: Tue, 3 Nov 2026 17:50:46 +0100 [thread overview]
Message-ID: <auoNQw4AW5xbCpqL@macbook> (raw)
In-Reply-To: <179370057186.349126.13750066367082256700.b4-review@b4>
On Tue, Nov 03, 2026 at 11:09:31 +0100, Mattijs Korpershoek wrote:
> Hi Carlo,
>
> Thank you for the patch.
>
> > A U-Boot image may embed its device tree, but a FIT which explicitly
> > names an FDT must not boot after that FDT fails to load or verify.
> > External FDT data is copied to its load address before verification,
> > so ignoring the error can leave an unverified device tree for U-Boot.
> >
> > Keep support for U-Boot images without a separate FDT, but reject
> > failures for an explicitly requested FDT in both firmware and loadables.
> >
> > Fixes: d879616e9e64 ("spl: fit: simplify logic for FDT loading for non-OS boots")
> > Signed-off-by: Carlo Caione <ccaione@baylibre.com>
> >
> > diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> > index 64e5f95546f1..a520db765065 100644
> > --- a/common/spl/spl_fit.c
> > +++ b/common/spl/spl_fit.c
> > @@ -491,11 +491,14 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
> > image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, 8);
> >
> > /* Figure out which device tree the board wants to use */
> > + spl_image->fdt_addr = NULL;
>
> What's the point of initializing fdt_addr to NULL here?
> It's assigned in both cases (whether node < 0 or not).
We actually have a way out if (node < 0) and (!gd->fdt_blob) and the
problematic path is that early return.
The problem starts in spl_load_simple_fit() where image_info is not
zero-initialized so ->fdt_addr is basically garbage.
When we return early this garbage is copied into spl_image->fdt_addr.
Even zero-initializing the passed struct doesn't fully solve the issue
because the helper also receives the main spl_image, which is reused
across boot attempts and can contain a stale FDT pointer.
So, setting fdt_addr to NULL is the quickest fix for all the cases.
--
Carlo Caione
next prev parent reply other threads:[~2026-11-03 16:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 12:24 [PATCH 0/6] Support fastboot boot in SPL Carlo Caione
2026-10-14 12:24 ` [PATCH 1/6] spl: fit: reject failures loading an explicitly requested FDT Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 16:50 ` Carlo Caione [this message]
2026-11-03 21:34 ` Guillaume La Roque
2026-10-14 12:24 ` [PATCH 2/6] fastboot: invalidate stale and incomplete downloads Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 21:35 ` Guillaume La Roque
2026-10-14 12:24 ` [PATCH 3/6] spl: ram: allow loading FIT images from a supplied buffer Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 16:51 ` Carlo Caione
2026-10-14 12:24 ` [PATCH 4/6] spl: support booting FIT images downloaded with fastboot Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 16:51 ` Carlo Caione
2026-10-14 12:24 ` [PATCH 5/6] spl: fastboot: support legacy U-Boot images Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 21:35 ` Guillaume La Roque
2026-10-14 12:24 ` [PATCH 6/6] spl: fastboot: support raw " Carlo Caione
2026-11-03 10:09 ` Mattijs Korpershoek
2026-11-03 21:35 ` Guillaume La Roque
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=auoNQw4AW5xbCpqL@macbook \
--to=ccaione@baylibre.com \
--cc=alchark@flipper.net \
--cc=anton@binarly.io \
--cc=aristo.chen@canonical.com \
--cc=daniel@makrotopia.org \
--cc=francesco@valla.it \
--cc=khilman@baylibre.com \
--cc=lukma@nabladev.com \
--cc=marek.vasut+usb@mailbox.org \
--cc=marex@nabladev.com \
--cc=me@samcday.com \
--cc=michal.simek@amd.com \
--cc=mkorpershoek@kernel.org \
--cc=peng.fan@nxp.com \
--cc=pengpeng@iscas.ac.cn \
--cc=philipp.tomsich@vrull.eu \
--cc=quentin.schulz@cherry.de \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=xypron.glpk@gmx.de \
--cc=york.sun@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.