summaryrefslogtreecommitdiff
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2018-10-27 00:34:39 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2018-10-27 00:34:39 +0300
commit1f244dc5213960f76e7463bbb5719c331045bbc9 (patch)
treec75eb162cce11f7e3b717bce0cc80609dbfb11bf /fs/overlayfs
parentbabf4770be0adc69e6d2de150f4040f175e24beb (diff)
downloadlinux-1f244dc5213960f76e7463bbb5719c331045bbc9.tar.xz
ovl: clean up error handling in ovl_get_tmpfile()
If security_inode_copy_up() fails, it should not set new_creds, so no need for the cleanup (which would've Oops-ed anyway, due to old_creds being NULL). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/copy_up.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 1cc797a08a5b..989782a0c0c9 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -477,9 +477,8 @@ static struct dentry *ovl_get_tmpfile(struct ovl_copy_up_ctx *c)
};
err = security_inode_copy_up(c->dentry, &new_creds);
- temp = ERR_PTR(err);
if (err < 0)
- goto out;
+ return ERR_PTR(err);
if (new_creds)
old_creds = override_creds(new_creds);
@@ -488,7 +487,7 @@ static struct dentry *ovl_get_tmpfile(struct ovl_copy_up_ctx *c)
temp = ovl_do_tmpfile(c->workdir, c->stat.mode);
else
temp = ovl_create_temp(c->workdir, &cattr);
-out:
+
if (new_creds) {
revert_creds(old_creds);
put_cred(new_creds);