Skip to content

Commit 267fc3a

Browse files
author
Al Viro
committed
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: 064fe6e ("mount: handle mount propagation for detached mount trees") Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 65781e1 commit 267fc3a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/namespace.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,15 +3715,14 @@ static int do_move_mount(struct path *old_path,
37153715
if (err)
37163716
goto out;
37173717

3718-
if (is_anon_ns(ns))
3719-
ns->mntns_flags &= ~MNTNS_PROPAGATING;
3720-
37213718
/* if the mount is moved, it should no longer be expire
37223719
* automatically */
37233720
list_del_init(&old->mnt_expire);
37243721
if (attached)
37253722
put_mountpoint(old_mp);
37263723
out:
3724+
if (is_anon_ns(ns))
3725+
ns->mntns_flags &= ~MNTNS_PROPAGATING;
37273726
unlock_mount(mp);
37283727
if (!err) {
37293728
if (attached) {

0 commit comments

Comments
 (0)