]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vfs: rename: check backing inode being equal
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 10 May 2016 23:16:37 +0000 (01:16 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 31 Jul 2016 04:21:14 +0000 (21:21 -0700)
commit8b0139a09c3046a891eaed989b4c30c7cac2ddb9
tree9e8f6beee1349fd28548e3b8d93b837df6216747
parentb4f6405a34d3271f9656a07dbe8ae8713af837cb
vfs: rename: check backing inode being equal

If a file is renamed to a hardlink of itself POSIX specifies that rename(2)
should do nothing and return success.

This condition is checked in vfs_rename().  However it won't detect hard
links on overlayfs where these are given separate inodes on the overlayfs
layer.

Overlayfs itself detects this condition and returns success without doing
anything, but then vfs_rename() will proceed as if this was a successful
rename (detach_mounts(), d_move()).

The correct thing to do is to detect this condition before even calling
into overlayfs.  This patch does this by calling vfs_select_inode() to get
the underlying inodes.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org> # v4.2+
Orabug: 24363418
CVE:CVE-2016-6198,CVE-2016-6197
Same as mainline v4.6 commit 9409e22acdfc9153f88d9b1ed2bd2a5b34d2d3ca
Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
fs/namei.c