Commit 01add3c7 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Ben Hutchings

mnt: fs_fully_visible test the proper mount for MNT_LOCKED

commit d71ed6c9 upstream.

MNT_LOCKED implies on a child mount implies the child is locked to the
parent.  So while looping through the children the children should be
tested (not their parent).

Typically an unshare of a mount namespace locks all mounts together
making both the parent and the slave as locked but there are a few
corner cases where other things work.

Fixes: ceeb0e5d ("vfs: Ignore unlocked mounts in fs_fully_visible")
Reported-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 3393778d
...@@ -3072,7 +3072,7 @@ static bool fs_fully_visible(struct file_system_type *type, int *new_mnt_flags) ...@@ -3072,7 +3072,7 @@ static bool fs_fully_visible(struct file_system_type *type, int *new_mnt_flags)
list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
struct inode *inode = child->mnt_mountpoint->d_inode; struct inode *inode = child->mnt_mountpoint->d_inode;
/* Only worry about locked mounts */ /* Only worry about locked mounts */
if (!(mnt->mnt.mnt_flags & MNT_LOCKED)) if (!(child->mnt.mnt_flags & MNT_LOCKED))
continue; continue;
/* Is the directory permanetly empty? */ /* Is the directory permanetly empty? */
if (!is_empty_dir_inode(inode)) if (!is_empty_dir_inode(inode))
......
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