]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1758310 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 6 Sep 2016 17:36:14 +0000 (17:36 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 6 Sep 2016 17:36:14 +0000 (17:36 +0000)
mpm_winnt: clear OVERLAPPED structs before reuse

MSDN documentation states that

    Any unused members of [an OVERLAPPED] structure should always be
    initialized to zero before the structure is used in a function call.
    Otherwise, the function may fail and return ERROR_INVALID_PARAMETER.

Prior to this patch, the internal state left over from previous
overlapped I/O was passed into the next call. It's unclear what effect
this might have, if any. (I have not personally witnessed an
ERROR_INVALID_PARAMETER myself.)
Submitted by: jchampion
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1759470 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/mpm/winnt/child.c

diff --git a/STATUS b/STATUS
index cfd7704f747653f5e071d79361cd10e1d4274e1c..d279ba6ef679d09efd7cd36d3b5c6e55f81a9e03 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -126,11 +126,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      2.4.x patch: trunk works (modulo CHANGES and APLOGNO's next-number)
      +1: jchampion, wrowe, covener
 
-   * mpm_winnt: always zero out OVERLAPPED structs when recycling them.
-     trunk patch: http://svn.apache.org/r1758310
-     2.4.x patch: trunk works
-     +1: jchampion, wrowe, covener
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 
index dee35df5b54d7283b39829feeca1977e6eae3721..16204d4e45e80090d7c04023a64975aaf0686698 100644 (file)
@@ -136,10 +136,17 @@ static void mpm_recycle_completion_context(winnt_conn_ctx_t *context)
      * state so -don't- close it.
      */
     if (context) {
+        HANDLE saved_event;
+
         apr_pool_clear(context->ptrans);
         context->ba = apr_bucket_alloc_create(context->ptrans);
         context->next = NULL;
+
+        saved_event = context->overlapped.hEvent;
+        memset(&context->overlapped, 0, sizeof(context->overlapped));
+        context->overlapped.hEvent = saved_event;
         ResetEvent(context->overlapped.hEvent);
+
         apr_thread_mutex_lock(qlock);
         if (qtail) {
             qtail->next = context;