From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Allan ELKAIM <allan.elkaim@gmail.com>
Cc: u-boot@lists.denx.de, Joao Marcos Costa <jmcosta944@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Tom Rini <trini@konsulko.com>,
Richard Genoud <richard.genoud@bootlin.com>
Subject: Re: [PATCH v1 0/2] fs/squashfs: fix symlink load failure on large images
Date: Fri, 22 May 2026 11:43:56 +0200 [thread overview]
Message-ID: <87jysvpyn7.fsf@bootlin.com> (raw)
In-Reply-To: <20260514181854.399679-3-allan.elkaim@gmail.com> (Allan ELKAIM's message of "Thu, 14 May 2026 20:18:50 +0200")
Hello Allan,
On 14/05/2026 at 20:18:50 +02, Allan ELKAIM <allan.elkaim@gmail.com> wrote:
> sqfsload fails to load a file through a symlink when the squashfs
> image contains a large number of inodes (e.g. a rootfs that includes
> the tzdata timezone database).
>
> Root cause: sqfs_read_nest() resolves the symlink by calling itself
> recursively without first freeing the parent directory's inode and
> directory table buffers. This causes a temporary double allocation
> that can exhaust the U-Boot heap. When malloc() subsequently fails
> inside sqfs_read_directory_table(), the error goes undetected and
> sqfs_search_dir() is called with a NULL pos_list pointer, leading to:
>
> Error: invalid inode reference to directory table.
> Failed to load '/boot/Image'
>
> Patch 1 fixes the structural problem (temporary double allocation)
> and plugs the silent NULL pointer path in sqfs_read_directory_table().
> Patch 2 adds the missing return-value checks on sqfs_dir_offset() that
> turn any residual lookup failure into a clean error propagation.
>
> Both patches are independent and can be reviewed separately.
>
> The bug was first observed on U-Boot v2024.01 and is still present
> on v2026.04. The patches have been tested on a Raspberry Pi CM4
> running U-Boot v2026.04 (Yocto Scarthgap 5.0.17) with a 325 MB
> squashfs rootfs containing 22 517 inodes. The symlink
> /boot/Image -> Image-6.6.63-v8 now resolves successfully.
>
> This series addresses the bug reported at:
> https://lists.denx.de/pipermail/u-boot/2026-May/618533.html
I haven't looked very deeply but changes look good.
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
I am adding Richard in case he wants to have a look.
Thanks,
Miquèl
prev parent reply other threads:[~2026-05-22 13:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <"CACgNL-F2=KJtZ+gThpx_BuWsn6puqFxK0uLOmnABSS9=rRQmeQ@mail.gmail.com">
2026-05-14 18:18 ` [PATCH v1 0/2] fs/squashfs: fix symlink load failure on large images Allan ELKAIM
2026-05-14 18:18 ` [PATCH v1 1/2] fs/squashfs: fix heap exhaustion during symlink resolution Allan ELKAIM
2026-05-22 13:28 ` Richard GENOUD
2026-05-14 18:18 ` [PATCH v1 2/2] fs/squashfs: add sqfs_dir_offset() error checks Allan ELKAIM
2026-05-22 13:29 ` Richard GENOUD
2026-05-23 14:35 ` Allan Elkaim
2026-05-23 14:48 ` [PATCH v2] fs/squashfs: fix missing error checks causing Synchronous Abort Allan ELKAIM
2026-05-26 7:35 ` Richard GENOUD
2026-05-22 9:43 ` Miquel Raynal [this message]
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=87jysvpyn7.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=allan.elkaim@gmail.com \
--cc=jmcosta944@gmail.com \
--cc=richard.genoud@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox