]> git.ipfire.org Git - thirdparty/u-boot.git/commit
Merge patch series "fs/squashfs: fix symlink load failure on large images"
authorTom Rini <trini@konsulko.com>
Sat, 25 Jul 2026 13:55:35 +0000 (07:55 -0600)
committerTom Rini <trini@konsulko.com>
Sat, 25 Jul 2026 13:55:35 +0000 (07:55 -0600)
commitb635d43bca429500cb8ef20aa151cb5773b9a8a5
treeba7cad4ef1b7c4b10e2f720a13b2d672ee3fb7b3
parentd99ad807509dcb7197a33261a269b5144e5e4acc
parent171b604888537dd7112ffddaa13abb16932eabd0
Merge patch series "fs/squashfs: fix symlink load failure on large images"

Allan ELKAIM <allan.elkaim@gmail.com> says:

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.

Patch 3 (reworked in v3 following Richard Genoud's review) fixes
pre-existing leaks of dirs->entry on the error paths of
sqfs_search_dir(), by centralizing the cleanup at the 'out' label.

All 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.u-boot-project.org/pipermail/u-boot/2026-May/618533.html

Link: https://lore.kernel.org/r/20260713142420.2618339-1-allan.elkaim@gmail.com
fs/squashfs/sqfs.c