linux-stable/fs/overlayfs
Amir Goldstein a9676c96e7 ovl: fix missing upper fs freeze protection on copy up for ioctl
commit 3428030da0 upstream.

Generalize the helper ovl_open_maybe_copy_up() and use it to copy up file
with data before FS_IOC_SETFLAGS ioctl.

The FS_IOC_SETFLAGS ioctl is a bit of an odd ball in vfs, which probably
caused the confusion.  File may be open O_RDONLY, but ioctl modifies the
file.  VFS does not call mnt_want_write_file() nor lock inode mutex, but
fs-specific code for FS_IOC_SETFLAGS does.  So ovl_ioctl() calls
mnt_want_write_file() for the overlay file, and fs-specific code calls
mnt_want_write_file() for upper fs file, but there was no call for
ovl_want_write() for copy up duration which prevents overlayfs from copying
up on a frozen upper fs.

Fixes: dab5ca8fd9 ("ovl: add lsattr/chattr support")
Cc: <stable@vger.kernel.org> # v4.19
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-25 18:23:30 +02:00
..
copy_up.c ovl: fix missing upper fs freeze protection on copy up for ioctl 2019-05-25 18:23:30 +02:00
dir.c ovl: fix missing override creds in link of a metacopy upper 2018-12-19 19:19:51 +01:00
export.c ovl: fix decode of dir file handle with multi lower layers 2018-12-19 19:19:51 +01:00
file.c ovl: fix missing upper fs freeze protection on copy up for ioctl 2019-05-25 18:23:30 +02:00
inode.c ovl: make symbol 'ovl_aops' static 2018-09-25 20:41:23 +02:00
Kconfig ovl: Provide a mount option metacopy=on/off for metadata copyup 2018-07-20 09:56:06 +02:00
Makefile ovl: stack file ops 2018-07-18 15:44:41 +02:00
namei.c ovl: fix error handling in ovl_verify_set_fh() 2018-11-21 09:19:12 +01:00
overlayfs.h ovl: fix missing upper fs freeze protection on copy up for ioctl 2019-05-25 18:23:30 +02:00
ovl_entry.h ovl: Store lower data inode in ovl_inode 2018-07-20 09:56:11 +02:00
readdir.c ovl: fix wrong use of impure dir cache in ovl_iterate() 2018-07-17 16:04:34 +02:00
super.c ovl: automatically enable redirect_dir on metacopy=on 2018-11-21 09:19:13 +01:00
util.c ovl: Do not lose security.capability xattr over metadata file copy-up 2019-03-23 20:09:59 +01:00