]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aio: fix newp->running data race
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 4 May 2016 13:14:29 +0000 (15:14 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 4 May 2016 13:14:29 +0000 (15:14 +0200)
* sysdeps/pthread/aio_misc.c (__aio_enqueue_request): Do not write
`running` field of `newp` when a thread was started to process it,
since that thread will not take `__aio_requests_mutex`, and the field
already has the proper value actually.

ChangeLog
sysdeps/pthread/aio_misc.c

index 45e8375e5f07991792bc70c41ba78d0e49113589..575c17f7a7fa4eb014e6879ebffc2f9edb9d9674 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-04  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+       * sysdeps/pthread/aio_misc.c (__aio_enqueue_request): Do not write
+       `running` field of `newp` when a thread was started to process it,
+       since that thread will not take `__aio_requests_mutex`, and the field
+       already has the proper value actually.
+
 2016-05-04  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #19787]
index f55570d23b5b39ed8976b2e320e1add701c98859..faf139d9011f2bdd3d649f8ec0088b8dff912559 100644 (file)
@@ -453,7 +453,11 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
                result = 0;
            }
        }
+      else
+       newp->running = running;
     }
+  else
+    newp->running = running;
 
   /* Enqueue the request in the run queue if it is not yet running.  */
   if (running == yes && result == 0)
@@ -466,9 +470,7 @@ __aio_enqueue_request (aiocb_union *aiocbp, int operation)
        pthread_cond_signal (&__aio_new_request_notification);
     }
 
-  if (result == 0)
-    newp->running = running;
-  else
+  if (result != 0)
     {
       /* Something went wrong.  */
       __aio_free_request (newp);