From 12dd02d884df84b9e6ea14e67c13a86482cf9cc5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Dec 2020 15:44:41 -0800 Subject: [PATCH] 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 --- source3/smbd/open.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { -- 2.47.2