s3: smbd: named pipe reads are async. Use the same logic as for named pipe transacts...
authorJeremy Allison <jra@samba.org>
Tue, 19 Sep 2023 00:09:00 +0000 (17:09 -0700)
committerJule Anger <janger@samba.org>
Fri, 22 Sep 2023 19:34:15 +0000 (19:34 +0000)
Noticed by Metze.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 3f32bf887d4425655e81da0b2234cbca3b1d56e6)

source3/smbd/smb2_read.c

index 0101c42cf76848f53d17876776e457a96056e877..bac78e4c77a4f4391ccada0734bc9ceafc61d692 100644 (file)
@@ -494,6 +494,7 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
 
        if (IS_IPC(smbreq->conn)) {
                struct tevent_req *subreq = NULL;
+               bool ok;
 
                state->out_data = data_blob_talloc(state, NULL, in_length);
                if (in_length > 0 && tevent_req_nomem(state->out_data.data, req)) {
@@ -515,6 +516,18 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
                tevent_req_set_callback(subreq,
                                        smbd_smb2_read_pipe_done,
                                        req);
+
+               /*
+                * Make sure we mark the fsp as having outstanding async
+                * activity so we don't crash on shutdown close.
+                */
+
+               ok = aio_add_req_to_fsp(fsp, req);
+               if (!ok) {
+                       tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
+                       return tevent_req_post(req, ev);
+               }
+
                return req;
        }