From: sashiko-bot@kernel.org
To: "Thorsten Blum" <blum@kernel.org>,
"David Sterba" <dsterba@suse.com>,
"Chris Mason" <mason@kernel.org>,
"Jaegeuk Kim" <jaegeuk@kernel.org>, "Chao Yu" <chao@kernel.org>,
"Richard Weinberger" <richard@nod.at>,
"Zhihao Cheng" <chengzhihao1@huawei.com>,
"Eric Biggers" <ebiggers@kernel.org>,
"Theodore Y. Ts'o" <tytso@mit.edu>
Cc: linux-mtd@lists.infradead.org, linux-fscrypt@vger.kernel.org,
dsterba@suse.cz
Subject: Re: [PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}()
Date: Wed, 18 Nov 2026 00:34:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-219851@kernel.org> (raw)
In-Reply-To: <20261118002845.574426-10-blum@kernel.org>
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] ubifs: missing read-only and error state checks in fileattr and
xattr setters [1]
--
commit b8fcd8b365f77753007ac6808d8a6b998a34c773
Author: Thorsten Blum <blum@kernel.org>
ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}()
This commit replaces FSTR_INIT(..., strlen(name)) with the FSTR() macro in
ubifs_xattr_set(), ubifs_xattr_get(), and ubifs_xattr_remove().
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 3b0e8a270f594..036eb7e2be0b2 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -252,7 +252,7 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
> {
> struct inode *inode;
> struct ubifs_info *c = host->i_sb->s_fs_info;
> - struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
> + struct fscrypt_name nm = { .disk_name = FSTR((char *)name) };
> struct ubifs_dent_node *xent;
> union ubifs_key key;
> int err;
[ ... ]
> @@ -557,7 +557,7 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
> {
> struct inode *inode;
> struct ubifs_info *c = host->i_sb->s_fs_info;
> - struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
> + struct fscrypt_name nm = { .disk_name = FSTR((char *)name) };
> struct ubifs_dent_node *xent;
> union ubifs_key key;
> int err;
[Severity: High]
This problem wasn't introduced by this patch, but can ubifs_xattr_set(),
ubifs_xattr_remove(), and setflags() (via ubifs_fileattr_set()) mutate state
on a read-only or errored UBIFS filesystem [1]?
A stacked filesystem such as ecryptfs can call vfs_setxattr(),
vfs_removexattr(), or vfs_fileattr_set() on a lower UBIFS mount without
acquiring write access on the lower mount, and those VFS helpers dispatch
into UBIFS without rejecting read-only or emergency read-only lower
superblocks.
ubifs_xattr_set() and ubifs_xattr_remove() then call create_xattr(),
change_xattr(), and remove_xattr(), which mutate in-memory host and xattr
inode state before reaching reserve_space(), where ubifs_assert(c,
!c->ro_media && !c->ro_mount) fires, c->ro_error is set, and the xattr inode
is marked bad. Similarly, setflags() in fs/ubifs/ioctl.c allocates dirty
inode budget via ubifs_budget_space() and dirties the inode without checking
c->ro_mount, c->ro_media, or c->ro_error, leaking c->bi.dd_growth on a
read-only mount and tripping ubifs_assert(c, c->bi.dd_growth == 0) at
unmount.
[1] https://sashiko.dev/#/bug/linux-5bb2275d-76e5-4d6a-b814-a7ac921778bf
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118002845.574426-6-blum@kernel.org?part=4
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Thorsten Blum" <blum@kernel.org>,
"David Sterba" <dsterba@suse.com>,
"Chris Mason" <mason@kernel.org>,
"Jaegeuk Kim" <jaegeuk@kernel.org>, "Chao Yu" <chao@kernel.org>,
"Richard Weinberger" <richard@nod.at>,
"Zhihao Cheng" <chengzhihao1@huawei.com>,
"Eric Biggers" <ebiggers@kernel.org>,
"Theodore Y. Ts'o" <tytso@mit.edu>
Cc: linux-mtd@lists.infradead.org, linux-fscrypt@vger.kernel.org,
dsterba@suse.cz
Subject: Re: [PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}()
Date: Wed, 18 Nov 2026 00:34:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-219851@kernel.org> (raw)
In-Reply-To: <20261118002845.574426-10-blum@kernel.org>
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] ubifs: missing read-only and error state checks in fileattr and
xattr setters [1]
--
commit b8fcd8b365f77753007ac6808d8a6b998a34c773
Author: Thorsten Blum <blum@kernel.org>
ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}()
This commit replaces FSTR_INIT(..., strlen(name)) with the FSTR() macro in
ubifs_xattr_set(), ubifs_xattr_get(), and ubifs_xattr_remove().
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 3b0e8a270f594..036eb7e2be0b2 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -252,7 +252,7 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
> {
> struct inode *inode;
> struct ubifs_info *c = host->i_sb->s_fs_info;
> - struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
> + struct fscrypt_name nm = { .disk_name = FSTR((char *)name) };
> struct ubifs_dent_node *xent;
> union ubifs_key key;
> int err;
[ ... ]
> @@ -557,7 +557,7 @@ static int ubifs_xattr_remove(struct inode *host, const char *name)
> {
> struct inode *inode;
> struct ubifs_info *c = host->i_sb->s_fs_info;
> - struct fscrypt_name nm = { .disk_name = FSTR_INIT((char *)name, strlen(name))};
> + struct fscrypt_name nm = { .disk_name = FSTR((char *)name) };
> struct ubifs_dent_node *xent;
> union ubifs_key key;
> int err;
[Severity: High]
This problem wasn't introduced by this patch, but can ubifs_xattr_set(),
ubifs_xattr_remove(), and setflags() (via ubifs_fileattr_set()) mutate state
on a read-only or errored UBIFS filesystem [1]?
A stacked filesystem such as ecryptfs can call vfs_setxattr(),
vfs_removexattr(), or vfs_fileattr_set() on a lower UBIFS mount without
acquiring write access on the lower mount, and those VFS helpers dispatch
into UBIFS without rejecting read-only or emergency read-only lower
superblocks.
ubifs_xattr_set() and ubifs_xattr_remove() then call create_xattr(),
change_xattr(), and remove_xattr(), which mutate in-memory host and xattr
inode state before reaching reserve_space(), where ubifs_assert(c,
!c->ro_media && !c->ro_mount) fires, c->ro_error is set, and the xattr inode
is marked bad. Similarly, setflags() in fs/ubifs/ioctl.c allocates dirty
inode budget via ubifs_budget_space() and dirties the inode without checking
c->ro_mount, c->ro_media, or c->ro_error, leaking c->bi.dd_growth on a
read-only mount and tripping ubifs_assert(c, c->bi.dd_growth == 0) at
unmount.
[1] https://sashiko.dev/#/bug/linux-5bb2275d-76e5-4d6a-b814-a7ac921778bf
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118002845.574426-6-blum@kernel.org?part=4
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-11-18 0:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 0:28 [PATCH 0/4] fscrypt: Add FSTR() helper macro and convert initializers Thorsten Blum
2026-11-18 0:28 ` Thorsten Blum
2026-11-18 0:28 ` [f2fs-dev] " Thorsten Blum via Linux-f2fs-devel
2026-11-18 0:28 ` [PATCH 1/4] fscrypt: Add FSTR() helper macro Thorsten Blum
2026-11-18 0:28 ` Thorsten Blum
2026-11-18 0:28 ` [f2fs-dev] " Thorsten Blum via Linux-f2fs-devel
2026-11-18 0:28 ` [PATCH 2/4] btrfs: Use FSTR() for the "default" name Thorsten Blum
2026-11-18 0:28 ` Thorsten Blum
2026-11-18 0:28 ` [f2fs-dev] " Thorsten Blum via Linux-f2fs-devel
2026-11-18 0:28 ` [PATCH 3/4] f2fs: Use FSTR() in f2fs_do_make_empty_dir() Thorsten Blum
2026-11-18 0:28 ` Thorsten Blum
2026-11-18 0:28 ` [f2fs-dev] " Thorsten Blum via Linux-f2fs-devel
2026-11-18 0:28 ` [PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}() Thorsten Blum
2026-11-18 0:28 ` Thorsten Blum
2026-11-18 0:28 ` [f2fs-dev] [PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set, get, remove}() Thorsten Blum via Linux-f2fs-devel
2026-11-18 0:34 ` sashiko-bot [this message]
2026-11-18 0:34 ` [PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}() sashiko-bot
2026-11-18 0:35 ` sashiko-bot
2026-11-18 0:35 ` sashiko-bot
2026-11-18 5:01 ` [f2fs-dev] [PATCH 0/4] fscrypt: Add FSTR() helper macro and convert initializers Eric Biggers via Linux-f2fs-devel
2026-11-18 5:01 ` Eric Biggers
2026-11-18 5:01 ` Eric Biggers
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-219851@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=blum@kernel.org \
--cc=chao@kernel.org \
--cc=chengzhihao1@huawei.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mason@kernel.org \
--cc=richard@nod.at \
--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.