Skip to content

f2fs: require write permission for ioctls that change per-file state

Hungyu Lin linux-f2fs-devel lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v11 patch 1 replySuperseded

Changes in v2 from the cover letter

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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4f2fs: require write permission for F2FS_IOC_SET_PIN_FILEfs/f2fs/file.c+3 -00 replies
2/4f2fs: require write permission for F2FS_IOC_RELEASE_COMPRESS_BLOCKSfs/f2fs/file.c+3 -00 replies
3/4f2fs: require write permission for F2FS_IOC_RESERVE_COMPRESS_BLOCKSfs/f2fs/file.c+3 -00 replies
4/4f2fs: require write permission for F2FS_IOC_IO_PRIOfs/f2fs/file.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

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/[email protected]/

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

Signature · 1 line
2.43.0