From: Eric W. Biederman Date: Fri, 27 May 2016 19:50:05 +0000 (-0500) Subject: mnt: fs_fully_visible test the proper mount for MNT_LOCKED X-Git-Tag: firefly_0821_release~176^2~4^2~37^2~132 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=57eb6e3dbdd3389a4325b8d5a42203591f64153d;p=firefly-linux-kernel-4.4.55.git mnt: fs_fully_visible test the proper mount for MNT_LOCKED commit d71ed6c930ac7d8f88f3cef6624a7e826392d61f 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: ceeb0e5d39fc ("vfs: Ignore unlocked mounts in fs_fully_visible") Reported-by: Seth Forshee Signed-off-by: "Eric W. Biederman" Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/namespace.c b/fs/namespace.c index 0570729c87fd..efb396f41fcd 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3262,7 +3262,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) { struct inode *inode = child->mnt_mountpoint->d_inode; /* Only worry about locked mounts */ - if (!(mnt_flags & MNT_LOCKED)) + if (!(child->mnt.mnt_flags & MNT_LOCKED)) continue; /* Is the directory permanetly empty? */ if (!is_empty_dir_inode(inode))