aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtmutex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-06-08 13:46:57 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-08 17:23:34 -0700
commitc0d1d2bf5a28f78def7b68ca1eb5ba31aafd43a1 (patch)
treec51260793d12005dcc244a1304193ce9898ed9cc /kernel/rtmutex.c
parentsata_promise: use TF interface for polling NODATA commands (diff)
downloadlinux-dev-c0d1d2bf5a28f78def7b68ca1eb5ba31aafd43a1.tar.xz
linux-dev-c0d1d2bf5a28f78def7b68ca1eb5ba31aafd43a1.zip
rt-mutex: fix stale return value
Alexey Kuznetsov found some problems in the pi-futex code. The major problem is a stale return value in rt_mutex_slowlock(): When the pi chain walk returns -EDEADLK, but the waiter was woken up during the phases where the locks were dropped, the rtmutex could be acquired, but due to the stale return value -EDEADLK returned to the caller. Reset the return value in the retry path. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Cc: Ulrich Drepper <drepper@redhat.com> Cc: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/rtmutex.c')
-rw-r--r--kernel/rtmutex.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 12879f6c1ec3..a273183c37a0 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -636,9 +636,16 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state,
* all over without going into schedule to try
* to get the lock now:
*/
- if (unlikely(!waiter.task))
+ if (unlikely(!waiter.task)) {
+ /*
+ * Reset the return value. We might
+ * have returned with -EDEADLK and the
+ * owner released the lock while we
+ * were walking the pi chain.
+ */
+ ret = 0;
continue;
-
+ }
if (unlikely(ret))
break;
}