Skip to content

Commit 12f147d

Browse files
author
Al Viro
committed
do_change_type(): refuse to operate on unmounted/not ours mounts
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 <[email protected]> Fixes: 07b2088 ("beginning of the shared-subtree proper") Reported-by: "Orlando, Noah" <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent c28f922 commit 12f147d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/namespace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,6 +2959,10 @@ static int do_change_type(struct path *path, int ms_flags)
29592959
return -EINVAL;
29602960

29612961
namespace_lock();
2962+
if (!check_mnt(mnt)) {
2963+
err = -EINVAL;
2964+
goto out_unlock;
2965+
}
29622966
if (type == MS_SHARED) {
29632967
err = invent_group_ids(mnt, recurse);
29642968
if (err)

0 commit comments

Comments
 (0)