Skip to content

Commit 958ed92

Browse files
chaseyuJaegeuk Kim
authored andcommitted
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: [email protected] Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent b5639bb commit 958ed92

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/f2fs/file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,10 @@ static long f2fs_fallocate(struct file *file, int mode,
17801780

17811781
inode_lock(inode);
17821782

1783+
ret = file_modified(file);
1784+
if (ret)
1785+
goto out;
1786+
17831787
if (mode & FALLOC_FL_PUNCH_HOLE) {
17841788
if (offset >= inode->i_size)
17851789
goto out;

0 commit comments

Comments
 (0)