diff options
author | Nick Kew <niq@apache.org> | 2008-02-22 23:17:42 +0100 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2008-02-22 23:17:42 +0100 |
commit | 6c1e11718648fd0215e0e7316fd9186eb7b5bb98 (patch) | |
tree | 9ad8fcf40e8a68d38d70a3fd7dc1bd466b84ab64 /server/mpm/worker | |
parent | Session cache interface redesign, Part 3: (diff) | |
download | apache2-6c1e11718648fd0215e0e7316fd9186eb7b5bb98.tar.xz apache2-6c1e11718648fd0215e0e7316fd9186eb7b5bb98.zip |
Worker MPM: fix race condition
PR44402: reported and fixed by Basant Kumar Kukreja
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@630335 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm/worker')
-rw-r--r-- | server/mpm/worker/fdqueue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/mpm/worker/fdqueue.c b/server/mpm/worker/fdqueue.c index 8be7c9fa2d..b88b8dacd8 100644 --- a/server/mpm/worker/fdqueue.c +++ b/server/mpm/worker/fdqueue.c @@ -94,10 +94,14 @@ apr_status_t ap_queue_info_set_idle(fd_queue_info_t *queue_info, sizeof(*new_recycle)); new_recycle->pool = pool_to_recycle; for (;;) { - new_recycle->next = queue_info->recycled_pools; + /* Save queue_info->recycled_pool in local variable next because + * new_recycle->next can be changed after apr_atomic_casptr + * function call. + */ + struct recycled_pool *next = queue_info->recycled_pools; + new_recycle->next = next; if (apr_atomic_casptr((volatile void**)&(queue_info->recycled_pools), - new_recycle, new_recycle->next) == - new_recycle->next) { + new_recycle, new_recycle->next) == next) { break; } } |