]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smb2_server: let smbd_smb2_flush_send_queue() destroy pending elements on dead connection
authorStefan Metzmacher <metze@samba.org>
Fri, 12 Mar 2021 17:34:06 +0000 (18:34 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 29 Mar 2021 19:36:37 +0000 (19:36 +0000)
Otherwise we'll keep the state of already finished requests arround.

This becomes critical as the next commit will cause us to
let pending requests running and keep the xconn alive for
the lifetime of pending requests, so we would not ever
make progress and deadlock.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14449

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_server.c

index d9de7f4ab06b39fd5263be9fd67659cd53de290a..930a4201359117ad6d8c1119aceda602b1db64f8 100644 (file)
@@ -4604,6 +4604,18 @@ static NTSTATUS smbd_smb2_flush_send_queue(struct smbXsrv_connection *xconn)
                bool ok;
                struct msghdr msg;
 
+               if (!NT_STATUS_IS_OK(xconn->transport.status)) {
+                       /*
+                        * we're not supposed to do any io
+                        * just flush all pending stuff.
+                        */
+                       xconn->smb2.send_queue_len--;
+                       DLIST_REMOVE(xconn->smb2.send_queue, e);
+
+                       talloc_free(e->mem_ctx);
+                       continue;
+               }
+
                if (e->sendfile_header != NULL) {
                        size_t size = 0;
                        size_t i = 0;