From: sashiko-bot@kernel.org
To: "Gabriel Krisman Bertazi" <krisman@suse.de>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/4] ext4: Expose the filesystem encoding through sysfs
Date: Mon, 28 Sep 2026 21:45:41 +0000 [thread overview]
Message-ID: <20260928214542.2DFDC1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260928213155.2612039-3-krisman@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ext4: NULL pointer deref in encoding_show() via dynamic casefold
--
commit c325498f77eea14582e06218baa713f49fde001a
Author: Gabriel Krisman Bertazi <krisman@suse.de>
ext4: Expose the filesystem encoding through sysfs
This commit introduces new sysfs attributes in ext4 to display the active
filesystem encoding and encoding flags. This provides users with a direct
interface to check casefold support without relying on dmesg parsing.
> diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
> index 923b375e017fa..bc1c59d67eed8 100644
> --- a/fs/ext4/sysfs.c
> +++ b/fs/ext4/sysfs.c
[ ... ]
> @@ -161,6 +163,25 @@ static ssize_t err_report_sec_store(struct ext4_sb_info *sbi,
> return count;
> }
>
> +static ssize_t encoding_show(struct ext4_sb_info *sbi, char *buf)
> +{
> +#if IS_ENABLED(CONFIG_UNICODE)
> + struct super_block *sb = sbi->s_sb;
> +
> + if (ext4_has_feature_casefold(sb))
> + return sysfs_emit(buf, "UTF-8 (%d.%d.%d)\n",
> + unicode_major(sb->s_encoding->version),
> + unicode_minor(sb->s_encoding->version),
> + unicode_rev(sb->s_encoding->version));
[Severity: High]
Does this introduce a regression where reading the sysfs attribute causes a
NULL pointer dereference if casefold is enabled dynamically?
If a privileged user dynamically enables EXT4_FEATURE_INCOMPAT_CASEFOLD on
an online filesystem via the EXT4_IOC_SET_TUNE_SB_PARAM ioctl, it updates
the in-memory on-disk superblock representation but does not load the
unicode map into the VFS superblock:
fs/ext4/ioctl.c:ext4_ioctl_set_tune_sb() {
...
if ((params.set_feature_incompat_mask &
EXT4_FEATURE_INCOMPAT_CASEFOLD)) {
enabling_casefold = 1;
...
}
In this state, ext4_has_feature_casefold(sb) evaluates to true, but
sb->s_encoding remains NULL. If the sysfs attribute is read,
encoding_show() will unconditionally dereference sb->s_encoding->version,
resulting in a system crash.
> +#endif
> + return sysfs_emit(buf, "(none)\n");
> +}
> +
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928213155.2612039-1-krisman@suse.de?part=2
next prev parent reply other threads:[~2026-09-28 21:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 21:31 [PATCH 0/4] Expose encoding information of volumes Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 1/4] shmem: Report casefold setting in mount options Gabriel Krisman Bertazi
2026-09-28 21:39 ` sashiko-bot
2026-09-29 14:00 ` Mohammed EL Kadiri
2026-09-29 15:17 ` Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 2/4] ext4: Expose the filesystem encoding through sysfs Gabriel Krisman Bertazi
2026-09-28 21:45 ` sashiko-bot [this message]
2026-09-29 0:18 ` Gabriel Krisman Bertazi
2026-09-28 21:31 ` [PATCH 3/4] ovl: Add /sys/fs/overlay plumbing Gabriel Krisman Bertazi
2026-09-28 21:38 ` sashiko-bot
2026-09-28 21:31 ` [PATCH 4/4] ovl: Expose the filesystem encoding through sysfs Gabriel Krisman Bertazi
2026-09-28 21:37 ` sashiko-bot
2026-09-29 14:15 ` Amir Goldstein
2026-09-29 14:40 ` Pali Rohár
2026-09-29 15:35 ` Gabriel Krisman Bertazi
2026-09-29 15:35 ` Gabriel Krisman Bertazi
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=20260928214542.2DFDC1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=krisman@suse.de \
--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.