From: sashiko-bot@kernel.org
To: "Peng Hao" <flyingpenghao@gmail.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext2: Set the superblock UUID
Date: Mon, 23 Nov 2026 04:54:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-228677@kernel.org> (raw)
In-Reply-To: <20261123044826.93953-1-flyingpeng@tencent.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] ext2: integer underflow in ext2_get_inode() when s_first_ino is
0 [1]
--
commit b9543efa7f637c4ab3ed734748dff30bc4e4d9aa
Author: Peng Hao <flyingpenghao@gmail.com>
ext2: Set the superblock UUID
This commit populates sb->s_uuid from the on-disk ext2 superblock in
ext2_fill_super() via super_set_uuid().
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 54a6c26d0388a..0c6edc68a94e2 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -1010,6 +1010,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
> sb->s_max_links = EXT2_LINK_MAX;
> sb->s_time_min = S32_MIN;
> sb->s_time_max = S32_MAX;
> + super_set_uuid(sb, es->s_uuid, sizeof(es->s_uuid));
>
> if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) {
> sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE;
[Severity: High]
This problem wasn't introduced by this patch, but can loading
sbi->s_first_ino from es->s_first_ino in the else branch right below cause
an integer underflow in ext2_get_inode() [1]?
fs/ext2/super.c:ext2_fill_super() {
...
if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) {
sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE;
sbi->s_first_ino = EXT2_GOOD_OLD_FIRST_INO;
} else {
sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
sbi->s_first_ino = le32_to_cpu(es->s_first_ino);
...
}
fs/ext2/inode.c:ext2_get_inode() {
...
if ((ino != EXT2_ROOT_INO && ino < EXT2_FIRST_INO(sb)) ||
ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count))
goto Einval;
block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
gdp = ext2_get_group_desc(sb, block_group, NULL);
...
}
If a corrupted filesystem image has es->s_first_ino == 0 (or >= 0x80000000,
which sign-extends the signed int sbi->s_first_ino), looking up ino 0 via
open_by_handle_at() -> ext2_fh_to_dentry() -> ext2_nfs_get_inode() ->
ext2_iget() -> ext2_get_inode() passes the ino < EXT2_FIRST_INO(sb) check.
Computing ino - 1 then underflows unsigned ino_t to ULONG_MAX, triggering a
WARN(1) in ext2_get_group_desc() or reading an unintended group descriptor
if 32-bit truncation of block_group wraps below s_groups_count.
[1] https://sashiko.dev/#/bug/linux-5ea0eb49-c55e-4623-9285-ee790480d577
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123044826.93953-1-flyingpeng@tencent.com?part=1
next prev parent reply other threads:[~2026-11-23 4:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 4:48 [PATCH] ext2: Set the superblock UUID Peng Hao
2026-11-23 4:54 ` sashiko-bot [this message]
2026-11-24 12:44 ` Jan Kara
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=sashiko-outbox-228677@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=flyingpenghao@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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.