android_kernel_motorola_sm6225/fs/overlayfs
Amir Goldstein 3e929ddf18 ovl: fix corner case of non-unique st_dev;st_ino
commit 9c6d8f13e9da10a26ad7f0a020ef86e8ef142835 upstream.

On non-samefs overlay without xino, non pure upper inodes should use a
pseudo_dev assigned to each unique lower fs and pure upper inodes use the
real upper st_dev.

It is fine for an overlay pure upper inode to use the same st_dev;st_ino
values as the real upper inode, because the content of those two different
filesystem objects is always the same.

In this case, however:
 - two filesystems, A and B
 - upper layer is on A
 - lower layer 1 is also on A
 - lower layer 2 is on B

Non pure upper overlay inode, whose origin is in layer 1 will have the same
st_dev;st_ino values as the real lower inode. This may result with a false
positive results of 'diff' between the real lower and copied up overlay
inode.

Fix this by using the upper st_dev;st_ino values in this case.  This breaks
the property of constant st_dev;st_ino across copy up of this case. This
breakage will be fixed by a later patch.

Fixes: 5148626b80 ("ovl: allocate anon bdev per unique lower fs")
Cc: stable@vger.kernel.org # v4.17+
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 20:34:51 +01: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: relax WARN_ON() for overlapping layers use case 2019-05-31 06:46:03 -07:00
export.c ovl: Fix dereferencing possible ERR_PTR() 2019-10-05 13:10:08 +02:00
file.c ovl: fix wrong flags check in FS_IOC_FS[SG]ETXATTR ioctls 2019-06-25 11:35:52 +08:00
inode.c ovl: fix corner case of non-unique st_dev;st_ino 2019-12-17 20:34:51 +01: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: detect overlapping layers 2019-06-25 11:35:52 +08:00
overlayfs.h ovl: detect overlapping layers 2019-06-25 11:35:52 +08:00
ovl_entry.h ovl: fix regression caused by overlapping layers detection 2019-09-21 07:17:14 +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: fix regression caused by overlapping layers detection 2019-09-21 07:17:14 +02:00
util.c ovl: detect overlapping layers 2019-06-25 11:35:52 +08:00