summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-11-13 12:16:43 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-04-03 04:28:51 -0700
commit975d6b3932d43b87a48d2107264ed0c9a7541d8d (patch)
treead82038ec23ccb2bdb00c1cdc13ae595e5a4dfbe /fs/namei.c
parentdd775ae2549217d3ae09363e3edb305d0fa19928 (diff)
downloadlinux-975d6b3932d43b87a48d2107264ed0c9a7541d8d.tar.gz
linux-975d6b3932d43b87a48d2107264ed0c9a7541d8d.tar.bz2
linux-975d6b3932d43b87a48d2107264ed0c9a7541d8d.zip
vfs: Don't allow a user namespace root to make device nodes
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>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 1898198abc3d..701954d68ac7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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)