Skip to content

Commit

Permalink
do_move_mount(): fix an unsafe use of is_anon_ns()
Browse files Browse the repository at this point in the history
What triggers it is a race between mount --move and umount -l
of the source; we should reject it (the source is parentless *and*
not the root of anon namespace at that), but the check for namespace
being an anon one is broken in that case - is_anon_ns() needs
ns to be non-NULL.  Better fixed here than in is_anon_ns(), since
the rest of the callers is guaranteed to get a non-NULL argument...

Reported-by: syzbot+494c7ddf66acac0ad747@syzkaller.appspotmail.com
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 9, 2019
1 parent 80f2321 commit 05883ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ static int do_move_mount(struct path *old_path, struct path *new_path)
if (attached && !check_mnt(old))
goto out;

if (!attached && !is_anon_ns(ns))
if (!attached && !(ns && is_anon_ns(ns)))
goto out;

if (old->mnt.mnt_flags & MNT_LOCKED)
Expand Down

0 comments on commit 05883ee

Please sign in to comment.