Commit 267fc3a0 authored by Al Viro's avatar Al Viro
Browse files

do_move_mount(): don't leak MNTNS_PROPAGATING on failures



as it is, a failed move_mount(2) from anon namespace breaks
all further propagation into that namespace, including normal
mounts in non-anon namespaces that would otherwise propagate
there.

Fixes: 064fe6e2 ("mount: handle mount propagation for detached mount trees")
Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 65781e19
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3715,15 +3715,14 @@ static int do_move_mount(struct path *old_path,
	if (err)
		goto out;

	if (is_anon_ns(ns))
		ns->mntns_flags &= ~MNTNS_PROPAGATING;

	/* if the mount is moved, it should no longer be expire
	 * automatically */
	list_del_init(&old->mnt_expire);
	if (attached)
		put_mountpoint(old_mp);
out:
	if (is_anon_ns(ns))
		ns->mntns_flags &= ~MNTNS_PROPAGATING;
	unlock_mount(mp);
	if (!err) {
		if (attached) {