Commit d26388bb authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Jiri Slaby

mnt: Move the clear of MNT_LOCKED from copy_tree to it's callers.

commit 8486a788 upstream.

Clear MNT_LOCKED in the callers of copy_tree except copy_mnt_ns, and
collect_mounts.  In copy_mnt_ns it is necessary to create an exact
copy of a mount tree, so not clearing MNT_LOCKED is important.
Similarly collect_mounts is used to take a snapshot of the mount tree
for audit logging purposes and auditing using a faithful copy of the
tree is important.

This becomes particularly significant when we start setting MNT_LOCKED
on rootfs to prevent it from being unmounted.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent cf9d5808
...@@ -1416,7 +1416,6 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, ...@@ -1416,7 +1416,6 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
if (IS_ERR(q)) if (IS_ERR(q))
return q; return q;
q->mnt.mnt_flags &= ~MNT_LOCKED;
q->mnt_mountpoint = mnt->mnt_mountpoint; q->mnt_mountpoint = mnt->mnt_mountpoint;
p = mnt; p = mnt;
......
...@@ -249,6 +249,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, ...@@ -249,6 +249,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp,
list_splice(tree_list, tmp_list.prev); list_splice(tree_list, tmp_list.prev);
goto out; goto out;
} }
child->mnt.mnt_flags &= ~MNT_LOCKED;
if (is_subdir(dest_mp->m_dentry, m->mnt.mnt_root)) { if (is_subdir(dest_mp->m_dentry, m->mnt.mnt_root)) {
mnt_set_mountpoint(m, dest_mp, child); mnt_set_mountpoint(m, dest_mp, child);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment