From 16b758ffa06956a6a584f71e48aecaee4bfbda1b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 23 Aug 2021 17:40:42 -0700 Subject: [PATCH 1/2] s3: mdssvc: Correctly disconnect the VFS connection inside the mds_ctx destructor. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14809 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme (cherry picked from commit b4d8c62c4e8191e05fd03dd096a0bc989e224ed3) --- source3/rpc_server/mdssvc/mdssvc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c index d0e87dcf646..fa31b55a183 100644 --- a/source3/rpc_server/mdssvc/mdssvc.c +++ b/source3/rpc_server/mdssvc/mdssvc.c @@ -1569,6 +1569,11 @@ static int mds_ctx_destructor_cb(struct mds_ctx *mds_ctx) } TALLOC_FREE(mds_ctx->ino_path_map); + if (mds_ctx->conn != NULL) { + SMB_VFS_DISCONNECT(mds_ctx->conn); + conn_free(mds_ctx->conn); + } + ZERO_STRUCTP(mds_ctx); return 0; -- 2.30.2 From 90c62f87939b82df4a326689815d2a31ad282bb9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 23 Aug 2021 17:42:40 -0700 Subject: [PATCH 2/2] s3: smbd: In create_conn_struct_cwd(), don't TALLOC_FREE() an unallocated pointer on error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just return the status - if create_conn_struct_as_root() fails the connection struct never gets returned. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14809 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed Aug 25 17:09:23 UTC 2021 on sn-devel-184 (cherry picked from commit 857045f3a236dea125200dd09279d677e513682b) --- source3/smbd/msdfs.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 45b6478985d..995ed815d90 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -525,12 +525,7 @@ NTSTATUS create_conn_struct_cwd(TALLOC_CTX *mem_ctx, path, session_info); unbecome_root(); - if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(c); - return status; - } - - return NT_STATUS_OK; + return status; } static void shuffle_strlist(char **list, int count) -- 2.30.2