Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55956b59 authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

vfs: Allow userns root to call mknod on owned filesystems.



These filesystems already always set SB_I_NODEV so mknod will not be
useful for gaining control of any devices no matter their permissions.
This will allow overlayfs and applications like to fakeroot to use
device nodes to represent things on disk.

Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 593d1ce8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3679,7 +3679,8 @@ 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)) && !capable(CAP_MKNOD))
	if ((S_ISCHR(mode) || S_ISBLK(mode)) &&
	    !ns_capable(dentry->d_sb->s_user_ns, CAP_MKNOD))
		return -EPERM;

	if (!dir->i_op->mknod)