diff options
author | Amir Goldstein <amir73il@gmail.com> | 2017-05-16 08:45:46 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2017-05-18 17:11:24 +0300 |
commit | 8137ae26d25303e7b5cfb418fd28b976461e5b6e (patch) | |
tree | e15b1c29eddff213d3b056cb6d274806d6609705 /fs/overlayfs | |
parent | 72d42504bd7faa6de1c1644b5e46652933e040a6 (diff) | |
download | linux-8137ae26d25303e7b5cfb418fd28b976461e5b6e.tar.xz |
ovl: fix creds leak in copy up error path
Fixes: 42f269b92540 ("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>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r-- | fs/overlayfs/copy_up.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 9008ab9fbd2e..061a8448e6c4 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -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) { |