From: Edward Adam Davis <eadavis@sina.com>
To: syzbot+68178aa1e39c8606392e@syzkaller.appspotmail.com
Cc: djwong@kernel.org, jack@suse.cz, krisman@kernel.org,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
tytso@mit.edu
Subject: [PATCH] ext4: Add validity checks for the casefold feature
Date: Mon, 30 Nov 2026 19:05:26 +0800 [thread overview]
Message-ID: <20261130110526.116017-1-eadavis@sina.com> (raw)
In-Reply-To: <6b0ce1e1.8ccee5ca.1045fd.02b4.GAE@google.com>
The EXT4_FEATURE_INCOMPAT_CASEFOLD feature is not enabled during the file
system mount process; consequently, s_encoding is not loaded into the
superblock. When the EXT4_FEATURE_INCOMPAT_CASEFOLD feature is enabled via
EXT4_IOC_SET_TUNE_SB_PARAM, sb->s_encoding is not initialized.
After the EXT4_CASEFOLD_FL flag is set on a dir via ext4_ioctl_setflags(),
the lookup operation performed on that directory triggers a call to the
ext4_fname_setup_ci_filename() function. This function passes the NULL
value of dir->i_sb->s_encoding to utf8_casefold(), which subsequently leads
to a null-ptr-deref of um->tables within utf8nlookup().
Added validity checks related to casefold feature to prevent referencing
an uninitialized encoding.
Fixes: 04a91570ac67 ("ext4: implemet new ioctls to set and get superblock parameters")
Reported-by: syzbot+68178aa1e39c8606392e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=68178aa1e39c8606392e
Signed-off-by: Edward Adam Davis <eadavis@sina.com>
---
fs/ext4/ioctl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 83630cd40712..48d30c529490 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -1464,7 +1464,10 @@ static int ext4_validate_tune_sb_params(struct super_block *sb,
(params->clear_feature_incompat_mask &
~EXT4_TUNE_CLEAR_INCOMPAT_SUPP) ||
(params->clear_feature_ro_compat_mask &
- ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP))
+ ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP) ||
+ (params->set_feature_incompat_mask &
+ EXT4_FEATURE_INCOMPAT_CASEFOLD &&
+ !sb->s_encoding))
return -EOPNOTSUPP;
/*
--
2.43.0
prev parent reply other threads:[~2026-11-30 11:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 2:39 [syzbot] [ext4?] general protection fault in utf8nlookup (2) syzbot
2026-11-30 11:05 ` Edward Adam Davis [this message]
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=20261130110526.116017-1-eadavis@sina.com \
--to=eadavis@sina.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=krisman@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+68178aa1e39c8606392e@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox