mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: jaegeuk@kernel.org, chao@kernel.org
Cc: daehojeong@google.com, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, dennylin0707@gmail.com
Subject: [PATCH v2 0/4] f2fs: require write permission for ioctls that change per-file state
Date: Thu, 12 Nov 2026 21:42:59 +0000	[thread overview]
Message-ID: <20261112214303.16198-1-dennylin0707@gmail.com> (raw)

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@gmail.com/

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


             reply	other threads:[~2026-11-12 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 21:42 Hungyu Lin [this message]
2026-11-12 21:43 ` [PATCH v2 1/4] f2fs: require write permission for F2FS_IOC_SET_PIN_FILE Hungyu Lin
2026-11-12 21:43 ` [PATCH v2 2/4] f2fs: require write permission for F2FS_IOC_RELEASE_COMPRESS_BLOCKS Hungyu Lin
2026-11-12 21:43 ` [PATCH v2 3/4] f2fs: require write permission for F2FS_IOC_RESERVE_COMPRESS_BLOCKS Hungyu Lin
2026-11-12 21:43 ` [PATCH v2 4/4] f2fs: require write permission for F2FS_IOC_IO_PRIO Hungyu Lin

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=20261112214303.16198-1-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=chao@kernel.org \
    --cc=daehojeong@google.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®