summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-06-04 12:27:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-19 15:32:21 +0200
commit9c1ddfeb662b668fff69c5f1cfdd9f5d23d55d23 (patch)
tree274480dfe7d900aebe71cb69feaeb2e2baed9213
parente1d02fe5040dbfed99faf4bd01ef9fe87c27d3c5 (diff)
do_change_type(): refuse to operate on unmounted/not ours mounts
[ Upstream commit 12f147ddd6de7382dad54812e65f3f08d05809fc ] Ensure that propagation settings can only be changed for mounts located in the caller's mount namespace. This change aligns permission checking with the rest of mount(2). Reviewed-by: Christian Brauner <brauner@kernel.org> Fixes: 07b20889e305 ("beginning of the shared-subtree proper") Reported-by: "Orlando, Noah" <Noah.Orlando@deshaw.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/namespace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 1022a5af691d..843bc6191f30 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2714,6 +2714,10 @@ static int do_change_type(struct path *path, int ms_flags)
return -EINVAL;
namespace_lock();
+ if (!check_mnt(mnt)) {
+ err = -EINVAL;
+ goto out_unlock;
+ }
if (type == MS_SHARED) {
err = invent_group_ids(mnt, recurse);
if (err)