Merge branches 'pm-cpuidle', 'pm-core' and 'pm-sleep'
[linux-2.6-microblaze.git] / fs / overlayfs / copy_up.c
index 6e4e65e..c14e907 100644 (file)
@@ -792,7 +792,7 @@ static int ovl_copy_up_tmpfile(struct ovl_copy_up_ctx *c)
        if (!c->metacopy && c->stat.size) {
                err = ovl_copy_up_file(ofs, c->dentry, tmpfile, c->stat.size);
                if (err)
-                       return err;
+                       goto out_fput;
        }
 
        err = ovl_copy_up_metadata(c, temp);
@@ -1011,6 +1011,10 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
        if (err)
                return err;
 
+       if (!kuid_has_mapping(current_user_ns(), ctx.stat.uid) ||
+           !kgid_has_mapping(current_user_ns(), ctx.stat.gid))
+               return -EOVERFLOW;
+
        ctx.metacopy = ovl_need_meta_copy_up(dentry, ctx.stat.mode, flags);
 
        if (parent) {