Skip to content

Commit

Permalink
ovl: fix creds leak in copy up error path
Browse files Browse the repository at this point in the history
Fixes: 42f269b ("ovl: rearrange code in ovl_copy_up_locked()")
Cc: <stable@vger.kernel.org> # v4.11
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Amir Goldstein authored and Miklos Szeredi committed May 18, 2017
1 parent 72d4250 commit 8137ae2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/overlayfs/copy_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,13 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir,
temp = ovl_do_tmpfile(upperdir, stat->mode);
else
temp = ovl_lookup_temp(workdir, dentry);
err = PTR_ERR(temp);
if (IS_ERR(temp))
goto out1;

err = 0;
if (!tmpfile)
if (IS_ERR(temp)) {
err = PTR_ERR(temp);
temp = NULL;
}

if (!err && !tmpfile)
err = ovl_create_real(wdir, temp, &cattr, NULL, true);

if (new_creds) {
Expand Down

0 comments on commit 8137ae2

Please sign in to comment.