From: Jeremy Allison Date: Wed, 16 Dec 2020 23:44:41 +0000 (-0800) Subject: smbd: On error exit in create_file_unixpath(), we can't call close_file() on uncomple... X-Git-Tag: samba-4.14.0rc1~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12dd02d884df84b9e6ea14e67c13a86482cf9cc5;p=thirdparty%2Fsamba.git smbd: On error exit in create_file_unixpath(), we can't call close_file() on uncompleted opens. We can't call directly into close_file(), as that cannot deal with regular file and directory opens where fsp->fsp_flags.is_fsa hasn't been set to true (uncompleted opens). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 87857f350d1..6ba0f5759dd 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -6091,7 +6091,13 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, */ base_fsp = NULL; } - close_file(req, fsp, ERROR_CLOSE); + if (!fsp->fsp_flags.is_fsa) { + /* Open wasn't completed. */ + fd_close(fsp); + file_free(req, fsp); + } else { + close_file(req, fsp, ERROR_CLOSE); + } fsp = NULL; } if (base_fsp != NULL) {