diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-03-08 10:50:43 -0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-04-12 22:22:02 -0400 |
commit | ad5cd4f4ee4d5fcdb1bfb7a0c073072961e70783 (patch) | |
tree | 327d0219545bfb055b6af9985bdf9194361e2112 /fs/ext4/ext4.h | |
parent | 919adbfec29d5b89b3e45620653cbeeb0d42e6fd (diff) | |
download | lwn-ad5cd4f4ee4d5fcdb1bfb7a0c073072961e70783.tar.gz lwn-ad5cd4f4ee4d5fcdb1bfb7a0c073072961e70783.zip |
ext4: fix fallocate to use file_modified to update permissions consistently
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.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20220308185043.GA117678@magnolia
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 3f87cca49f0c..1d79012c5a5b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3032,7 +3032,7 @@ extern int ext4_inode_attach_jinode(struct inode *inode); extern int ext4_can_truncate(struct inode *inode); extern int ext4_truncate(struct inode *); extern int ext4_break_layouts(struct inode *); -extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length); +extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length); extern void ext4_set_inode_flags(struct inode *, bool init); extern int ext4_alloc_da_blocks(struct inode *inode); extern void ext4_set_aops(struct inode *inode); |