]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ovl: verify upper dentry in ovl_remove_and_whiteout()
authorMaxim Patlasov <mpatlasov@virtuozzo.com>
Fri, 22 Jul 2016 01:24:26 +0000 (18:24 -0700)
committerSasha Levin <alexander.levin@verizon.com>
Mon, 8 Aug 2016 01:59:02 +0000 (21:59 -0400)
commit5eaee47bcdf4f17e2bdd6105f12b6d5e567e72c4
treef83b04a75ccb8c0d40996cccb22d0fa15fe5e49e
parenta9d39310cf41fe1306c18730c98ca2c3355fcb0c
ovl: verify upper dentry in ovl_remove_and_whiteout()

[ Upstream commit cfc9fde0b07c3b44b570057c5f93dda59dca1c94 ]

The upper dentry may become stale before we call ovl_lock_rename_workdir.
For example, someone could (mistakenly or maliciously) manually unlink(2)
it directly from upperdir.

To ensure it is not stale, let's lookup it after ovl_lock_rename_workdir
and and check if it matches the upper dentry.

Essentially, it is the same problem and similar solution as in
commit 11f3710417d0 ("ovl: verify upper dentry before unlink and rename").

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
fs/overlayfs/dir.c