]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: named pipe writes are async. Use the same logic as for named pipe transacts...
authorJeremy Allison <jra@samba.org>
Tue, 19 Sep 2023 00:37:44 +0000 (17:37 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 20 Sep 2023 01:49:34 +0000 (01:49 +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>
source3/smbd/smb2_write.c

index 269c489642ec87ee3e2ee2a3933f77559daf937c..a7af20173a178bff159ecfc01f4faeccd2e7e500 100644 (file)
@@ -307,6 +307,7 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
 
        if (IS_IPC(smbreq->conn)) {
                struct tevent_req *subreq = NULL;
+                bool ok;
 
                if (!fsp_is_np(fsp)) {
                        tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
@@ -323,6 +324,18 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
                tevent_req_set_callback(subreq,
                                        smbd_smb2_write_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;
        }