From bb9c4198fcfcd0d9ecf75a822caa65f17f666b05 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 28 Mar 2018 22:46:27 +0200 Subject: [PATCH] server: Don't change iosb without associated async in wake_message. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- server/named_pipe.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/named_pipe.c b/server/named_pipe.c index c77b07fc91b..a6f5fb6aa3c 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -356,13 +356,12 @@ static void wake_message( struct pipe_message *message ) struct async *async = message->async; message->async = NULL; + if (!async) return; + message->iosb->status = STATUS_SUCCESS; message->iosb->result = message->iosb->in_size; - if (async) - { - async_terminate( async, message->iosb->result ? STATUS_ALERTED : STATUS_SUCCESS ); - release_object( async ); - } + async_terminate( async, message->iosb->result ? STATUS_ALERTED : STATUS_SUCCESS ); + release_object( async ); } static void free_message( struct pipe_message *message ) @@ -768,7 +767,7 @@ static void reselect_write_queue( struct pipe_end *pipe_end ) else { avail += message->iosb->in_size - message->read_pos; - if (message->iosb->status == STATUS_PENDING && (avail <= reader->buffer_size || !message->iosb->in_size)) + if (message->async && (avail <= reader->buffer_size || !message->iosb->in_size)) wake_message( message ); } }