diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-05 04:21:36 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-05 04:21:36 +0200 |
commit | 2cd7cdc7e420a343743db781484e801fd784a1f1 (patch) | |
tree | 905bc14c6cd00ba92a56ee8ab5cb809451bb5d06 /fs | |
parent | Merge tag 'sound-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/... (diff) | |
parent | vfs: move_mount: reject moving kernel internal mounts (diff) | |
download | linux-2cd7cdc7e420a343743db781484e801fd784a1f1.tar.xz linux-2cd7cdc7e420a343743db781484e801fd784a1f1.zip |
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/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
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namespace.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 7660c2749c96..6fbc9126367a 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -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) |