On Sat, 2011-09-24 at 19:37 +0200, Manfred Spraul wrote:If IS_ERR(), then sem_lock() failed - thus there must be no unlock.
sma = sem_lock(ns, semid);
@@ -1456,8 +1414,17 @@ sleep_again:you just lost a sem_unlock() in the IS_ERR() case.
/*
* Wait until it's guaranteed that no wakeup_sem_queue_do() is ongoing.
*/
- error = get_queue_result(&queue);
-
+ error = queue.status;
+ if (error != -EINTR) {
+ /* If there is a return code, then we can leave immediately. */
+ if (!IS_ERR(sma)) {
+ sem_unlock(sma);
+ }
+ /* Except that we must wait for the hands-off */
+ wait_for_completion(&queue.done);
+ goto out_free;
+ }