ovl: prevent private clone if bind mount is not allowed
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 9 Aug 2021 08:19:47 +0000 (10:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 Aug 2021 11:01:04 +0000 (13:01 +0200)
commite3eee87c846dc47f6d8eb6d85e7271f24122a279
treee5103d8e0f6fd7e6e5150ce6e7b6028c76f2b20a
parentffdc1e312e2074875147c1df90764a9bae56f11f
ovl: prevent private clone if bind mount is not allowed

commit 427215d85e8d1476da1a86b8d67aceb485eb3631 upstream.

Add the following checks from __do_loopback() to clone_private_mount() as
well:

 - verify that the mount is in the current namespace

 - verify that there are no locked children

Reported-by: Alois Wohlschlager <alois1@gmx-topmail.de>
Fixes: c771d683a62e ("vfs: introduce clone_private_mount()")
Cc: <stable@vger.kernel.org> # v3.18
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c