This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix lll_unlock twice in pthread_cond_broadcast
- From: Yang Yingliang <yangyingliang at huawei dot com>
- To: <libc-alpha at sourceware dot org>
- Cc: <siddhesh at redhat dot com>, <yangyingliang at huawei dot com>
- Date: Wed, 30 Apr 2014 17:39:58 +0800
- Subject: [PATCH] Fix lll_unlock twice in pthread_cond_broadcast
- Authentication-results: sourceware.org; auth=none
lll_unlock() will be called again if it goes to "wake_all"
in pthread_cond_broadcast(). This may make another thread
which is waiting for lock in pthread_cond_timedwait() unlock.
So there are more than one threads get the lock, it will break
the shared data.
It's introduced by commit 8313cb997d2d("FUTEX_*_REQUEUE_PI support for non-x86 code")
---
nptl/pthread_cond_broadcast.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index ed30e7c60bc7..7c6c9ea9a2d5 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -81,6 +81,7 @@ __pthread_cond_broadcast (cond)
wake_all:
lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared);
+ return 0;
}
/* We are done. */
--
1.8.0