]> Pileus Git - ~andy/linux/commitdiff
vfs: Don't allow a user namespace root to make device nodes
authorEric W. Biederman <ebiederm@xmission.com>
Sun, 13 Nov 2011 20:16:43 +0000 (12:16 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 3 Apr 2012 11:28:51 +0000 (04:28 -0700)
Safely making device nodes in a container is solvable but simply
having the capability in a user namespace is not sufficient to make
this work.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
fs/namei.c

index 1898198abc3d10ed4126c73ab24035f0c796a877..701954d68ac7263ea4017c785d5f927ce62abeec 100644 (file)
@@ -2560,8 +2560,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
        if (error)
                return error;
 
-       if ((S_ISCHR(mode) || S_ISBLK(mode)) &&
-           !ns_capable(inode_userns(dir), CAP_MKNOD))
+       if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
                return -EPERM;
 
        if (!dir->i_op->mknod)