mnt: Carefully set CL_UNPRIVILEGED in clone_mnt
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 8 Oct 2014 00:11:46 +0000 (17:11 -0700)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 2 Dec 2014 16:46:50 +0000 (10:46 -0600)
old->mnt_expiry should be ignored unless CL_EXPIRE is set.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/namespace.c

index e8d1ffa7f132e9f32e72092cf0b3b2e97da41002..f87a90b98da2759a2014fc0eab3a51218cdb6e95 100644 (file)
@@ -963,7 +963,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
        }
 
        /* Don't allow unprivileged users to reveal what is under a mount */
-       if ((flag & CL_UNPRIVILEGED) && list_empty(&old->mnt_expire))
+       if ((flag & CL_UNPRIVILEGED) &&
+           (!(flag & CL_EXPIRE) || list_empty(&old->mnt_expire)))
                mnt->mnt.mnt_flags |= MNT_LOCKED;
 
        atomic_inc(&sb->s_active);