[PATCH v2 0/4] f2fs: require write permission for ioctls that change per-file state

From: Hungyu Lin

Date: Thu Nov 12 2026 - 22:36:25 EST


F2FS_IOC_SET_PIN_FILE, F2FS_IOC_RELEASE_COMPRESS_BLOCKS,
F2FS_IOC_RESERVE_COMPRESS_BLOCKS and F2FS_IOC_IO_PRIO change the state
of the inode behind the file descriptor without checking who the
caller is, so any user who can open a file read-only can change that
state. Each patch requires write permission on the inode in one of
these ioctls.

inode_permission() does not depend on how the file was opened, so
f2fs_io can keep using read-only file descriptors and does not need to
change. It does refuse write access to immutable files, so these ioctls
now fail on immutable files as well.

Changes since v1:
- Check write permission with inode_permission() instead of
inode_owner_or_capable(), as suggested by Chao Yu.
- Split into one patch per ioctl.

v1: https://lore.kernel.org/all/20261108045722.12091-1-dennylin0707@xxxxxxxxx/

Hungyu Lin (4):
f2fs: require write permission for F2FS_IOC_SET_PIN_FILE
f2fs: require write permission for F2FS_IOC_RELEASE_COMPRESS_BLOCKS
f2fs: require write permission for F2FS_IOC_RESERVE_COMPRESS_BLOCKS
f2fs: require write permission for F2FS_IOC_IO_PRIO

fs/f2fs/file.c | 12 ++++++++++++
1 file changed, 12 insertions(+)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.43.0