From: sashiko-bot@kernel.org
To: "Hemanth Selam" <hemanth.selam@gmail.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: skip extra isize expansion while unmounting
Date: Mon, 24 Aug 2026 10:01:41 +0000 [thread overview]
Message-ID: <20260824100141.86E351F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824094512.2436628-1-hemanth.selam@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete fix for a TOCTOU race condition that can lead to a NULL pointer dereference during unmount.
--
--- Patch [1]: [PATCH] ext4: skip extra isize expansion while unmounting ---
commit b6a44628f998028bf5040431bbd5fcff301de3c8
Author: Hemanth Selam <hemanth.selam@gmail.com>
ext4: skip extra isize expansion while unmounting
This patch attempts to fix a warning in ext4_xattr_inode_create reached
during unmount. It declines to expand the extra isize when s_root is
cleared during the dcache shrink but before SB_ACTIVE is cleared.
Closes: https://syzkaller.appspot.com/bug?extid=4b03894b6ec5753ddf24
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index bd4b778df9eb2..6e523a5c8230e 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -6598,8 +6598,14 @@ static int ext4_try_to_expand_extra_isize(struct inode *inode,
[ ... ]
> + * Skip it while unmounting as well. shrink_dcache_for_umount()
> + * clears s_root before generic_shutdown_super() clears SB_ACTIVE, and
> + * the last iput() of a lazytime inode in that window redirties it and
> + * lands here. Moving xattrs out to a block then needs a new EA inode,
> + * which ext4_xattr_inode_create() refuses without s_root.
> */
> - if (unlikely(!(inode->i_sb->s_flags & SB_ACTIVE)))
> + if (unlikely(!(inode->i_sb->s_flags & SB_ACTIVE) || !inode->i_sb->s_root))
> return -EBUSY;
>
> /*
[Severity: High]
This isn't a bug introduced by this patch, but does checking s_root here
without synchronization leave a race open during unmount?
Background workqueues like rsv_conversion_wq and s_ea_inode_work can
process inodes concurrently with unmount. They are not flushed until
sync_filesystem() and ext4_put_super(), which run after
shrink_dcache_for_umount() clears s_root.
If a background thread sees a non-NULL s_root here, could the unmount
thread concurrently clear s_root right after? The background thread would
then proceed into ext4_xattr_inode_create():
fs/ext4/xattr.c:ext4_xattr_inode_create() {
...
ea_inode = ext4_new_inode(handle, inode->i_sb->s_root->d_inode,
S_IFREG | 0600, NULL, inode->i_ino + 1, owner,
EXT4_EA_INODE_FL);
...
}
If s_root is cleared by the unmount thread just before this dereference,
could this result in a NULL pointer dereference on s_root->d_inode? Or if
s_root is cleared right before the warning check inside
ext4_xattr_inode_create(), wouldn't we still hit the original warning?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260824094512.2436628-1-hemanth.selam@gmail.com?part=1
next prev parent reply other threads:[~2026-08-24 10:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 9:45 [PATCH] ext4: skip extra isize expansion while unmounting Hemanth Selam
2026-08-24 10:01 ` sashiko-bot [this message]
2026-08-25 7:58 ` Hemanth Selam
2026-08-26 13:20 ` Jan Kara
2026-09-01 9:55 ` Jun Nie
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=20260824100141.86E351F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hemanth.selam@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.