From: Eric W. Biederman Date: Sun, 13 Nov 2011 20:16:43 +0000 (-0800) Subject: vfs: Don't allow a user namespace root to make device nodes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=975d6b3932d43b87a48d2107264ed0c9a7541d8d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Eric W. Biederman --- 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)