]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ext4: fix fallocate to use file_modified to update permissions consistently
authorDarrick J. Wong <djwong@kernel.org>
Tue, 8 Mar 2022 18:50:43 +0000 (10:50 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 22 Jun 2022 12:22:23 +0000 (14:22 +0200)
commit7c8a2127b07557f12c5c3ebafb977a389fb95303
tree082686407f6756d733be2a5c0a3661cbfa97869d
parent8336bf5a9cbe649ecebb0a343df4bbae96f9515f
ext4: fix fallocate to use file_modified to update permissions consistently

BugLink: https://bugs.launchpad.net/bugs/1972905
commit ad5cd4f4ee4d5fcdb1bfb7a0c073072961e70783 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/inode.c