Re: [PATCH 1/2] squashfs: return -EINVAL on invalid directory inode size

From: William Chuang

Date: Mon Nov 16 2026 - 19:54:15 EST


Hi Aibing,

Two more open syzbot reports on linux-next 84abb955b101 have the same
root cause as this patch: the two new "i_size < 3" checks in
squashfs_read_inode() reach failed_read with err still holding the
positive byte count of the inode read (32 or 40).

kernel BUG in vfs_get_tree (3)
https://syzkaller.appspot.com/bug?extid=7b1d0ea11475e857d063
(mount: get_tree() returns 40 and fc->root is never set)

general protection fault in security_d_instantiate
https://syzkaller.appspot.com/bug?extid=d8a69701a6e796ad5d3e
(lookup: squashfs_iget() returns ERR_PTR(40), which IS_ERR() does
not catch, and d_splice_alias() dereferences it)

The second was filed under [lsm?], so it will probably stay open
unless the fix names it. Whichever version is applied -- this one, or
"Squashfs: return -EINVAL when directory size check fails" (cc'd),
which changes the same two lines -- could carry all three reports:

Reported-by: syzbot+5d7ba5f6127ed887f459@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=5d7ba5f6127ed887f459
Reported-by: syzbot+7b1d0ea11475e857d063@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=7b1d0ea11475e857d063
Reported-by: syzbot+d8a69701a6e796ad5d3e@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=d8a69701a6e796ad5d3e

For reference, a CBMC model check of squashfs_read_inode() as it is in
linux-next returns 40 for a long directory inode with i_size = 1. With
this patch applied it returns only 0 or -errno for every inode type,
and squashfs_lookup() then never hands d_splice_alias() an inode that
is neither NULL nor real. Harnesses and outputs:
https://github.com/williamchuang/linux-kernel-contributions/tree/main/squashfs-lookup-errcode

This analysis was done with the help of an AI assistant; I have
checked it and take responsibility for it.

Thanks,
William