ovl: fix tmpfile leak
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 24 Jan 2023 15:41:18 +0000 (16:41 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 27 Jan 2023 15:16:12 +0000 (16:16 +0100)
Missed an error cleanup.

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

index 6e4e65e..140f274 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);