Re: [PATCH] squashfs: fix NULL pointer deref in squashfs_lookup TRACE
From: Andrew Morton
Date: Thu Nov 26 2026 - 18:49:53 EST
On Thu, 26 Nov 2026 19:19:24 +0800 Shuai Liu <847807867@xxxxxx> wrote:
> In squashfs_lookup(), commit 5b515c0ec855 ("Squashfs: don't compute start
> or alloc memory on empty directory or index") moved the TRACE statement
> to before the block/offset variable initialization, so the TRACE was
> rewritten to use squashfs_i(inode) instead of squashfs_i(dir). But
> inode is initialized to NULL, so squashfs_i(NULL) evaluates to an
> invalid pointer which triggers a kernel page fault when
> CONFIG_DYNAMIC_DEBUG or DEBUG enables the pr_debug() call.
>
> ...
>
> - TRACE("Entered squashfs_lookup [%llx:%x]\n", squashfs_i(inode)->start,
> - squashfs_i(inode)->offset);
> + TRACE("Entered squashfs_lookup [%llx:%x]\n", squashfs_i(dir)->start,
> + squashfs_i(dir)->offset);
>
> if (len > SQUASHFS_NAME_LEN)
> return ERR_PTR(-ENAMETOOLONG);
Yep, thanks, Phillip squashed this bug in the v4 series.