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 <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>

Al Viro 12f147dd c28f922c

+4
+4
fs/namespace.c
··· 2959 return -EINVAL; 2960 2961 namespace_lock(); 2962 if (type == MS_SHARED) { 2963 err = invent_group_ids(mnt, recurse); 2964 if (err)
··· 2959 return -EINVAL; 2960 2961 namespace_lock(); 2962 + if (!check_mnt(mnt)) { 2963 + err = -EINVAL; 2964 + goto out_unlock; 2965 + } 2966 if (type == MS_SHARED) { 2967 err = invent_group_ids(mnt, recurse); 2968 if (err)