[PATCH 4/4] ubifs: Use FSTR() in ubifs_xattr_{set,get,remove}()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 16:35:41 PST 2026


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]
--

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-7-blum@kernel.org?part=4



More information about the linux-mtd mailing list