|
@@ -2941,10 +2941,16 @@ static inline int open_to_namei_flags(int flag)
|
|
|
|
|
|
static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode)
|
|
|
{
|
|
|
+ struct user_namespace *s_user_ns;
|
|
|
int error = security_path_mknod(dir, dentry, mode, 0);
|
|
|
if (error)
|
|
|
return error;
|
|
|
|
|
|
+ s_user_ns = dir->dentry->d_sb->s_user_ns;
|
|
|
+ if (!kuid_has_mapping(s_user_ns, current_fsuid()) ||
|
|
|
+ !kgid_has_mapping(s_user_ns, current_fsgid()))
|
|
|
+ return -EOVERFLOW;
|
|
|
+
|
|
|
error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC);
|
|
|
if (error)
|
|
|
return error;
|