]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ovl: fix tmpfile leak
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 24 Jan 2023 15:41:18 +0000 (16:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:38 +0000 (08:34 +0100)
commit baabaa505563362b71f2637aedd7b807d270656c upstream.

Missed an error cleanup.

Reported-by: syzbot+fd749a7ea127a84e0ffd@syzkaller.appspotmail.com
Fixes: e4b2e7b40897 ("ovl: use vfs_tmpfile_open() helper")
Cc: <stable@vger.kernel.org> # v6.1
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/overlayfs/copy_up.c

index f436d8847f085a7e981b535e535ccba66b7f10ed..b72e62c123a4bc5dede2a888060c14cee2186e56 100644 (file)
@@ -754,7 +754,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);