Skip to content

Commit

Permalink
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/viro/vfs

Pull do_move_mount() fix from Al Viro:
 "Regression fix"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  vfs: move_mount: reject moving kernel internal mounts
  • Loading branch information
torvalds committed Jul 5, 2019
2 parents c212dda + 570d7a9 commit 2cd7cdc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2596,11 +2596,12 @@ static int do_move_mount(struct path *old_path, struct path *new_path)
if (!check_mnt(p))
goto out;

/* The thing moved should be either ours or completely unattached. */
if (attached && !check_mnt(old))
/* The thing moved must be mounted... */
if (!is_mounted(&old->mnt))
goto out;

if (!attached && !(ns && is_anon_ns(ns)))
/* ... and either ours or the root of anon namespace */
if (!(attached ? check_mnt(old) : is_anon_ns(ns)))
goto out;

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

0 comments on commit 2cd7cdc

Please sign in to comment.