]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: fix fallocate to use file_modified to update permissions consistently
authorChao Yu <chao@kernel.org>
Tue, 17 May 2022 03:37:23 +0000 (11:37 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 18 May 2022 22:36:09 +0000 (15:36 -0700)
commit51087197875019ffe10756ea7b79ec730d992f5c
tree9b0650adf8db05cdaac745fd94afaa85843c91d2
parenta791b21df56550cb9cf85fbb4c1d5a36c36087de
f2fs: fix fallocate to use file_modified to update permissions consistently

This patch tries to fix permission consistency issue as all other
mainline filesystems.

Since the initial introduction of (posix) fallocate back at the turn of
the century, it has been possible to use this syscall to change the
user-visible contents of files.  This can happen by extending the file
size during a preallocation, or through any of the newer modes (punch,
zero, collapse, insert range).  Because the call can be used to change
file contents, we should treat it like we do any other modification to a
file -- update the mtime, and drop set[ug]id privileges/capabilities.

The VFS function file_modified() does all this for us if pass it a
locked inode, so let's make fallocate drop permissions correctly.

Cc: stable@kernel.org
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c