[patch 03/26] rt-mutex: Fix stale return value
- From: Greg KH <gregkh@xxxxxxx>
- Date: Mon, 30 Jul 2007 21:31:24 -0700
-stable review patch. If anyone has any objections, please let us know.
------------------
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 woken up path.
Cc: Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Chris Wright <chrisw@xxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
kernel/rtmutex.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- linux-2.6.21.6.orig/kernel/rtmutex.c
+++ linux-2.6.21.6/kernel/rtmutex.c
@@ -659,9 +659,16 @@ rt_mutex_slowlock(struct rt_mutex *lock,
* 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;
}
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- [patch 00/26] 2.6.21.7 -stable review
- From: Greg KH
- [patch 00/26] 2.6.21.7 -stable review
- Prev by Date: [patch 02/26] sparsemem: fix oops in x86_64 show_mem
- Next by Date: [patch 04/26] rt-mutex: Fix chain walk early wakeup bug
- Previous by thread: [patch 02/26] sparsemem: fix oops in x86_64 show_mem
- Next by thread: [patch 04/26] rt-mutex: Fix chain walk early wakeup bug
- Index(es):
Relevant Pages
|