From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Steven Rostedt <rostedt@goodmis.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Ulrich Drepper <drepper@redhat.com>
Subject: [patch 1/4] rt-mutex: Fix stale return value
Date: Fri, 08 Jun 2007 00:29:17 -0000 [thread overview]
Message-ID: <20070607235801.429050000@linutronix.de> (raw)
In-Reply-To: 20070607235106.387346000@linutronix.de
[-- Attachment #1: rtmutex-fix-stale-return-value.patch --]
[-- Type: text/plain, Size: 1270 bytes --]
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>
---
kernel/rtmutex.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
Index: linux-2.6.22-rc4/kernel/rtmutex.c
===================================================================
--- linux-2.6.22-rc4.orig/kernel/rtmutex.c 2007-06-08 01:39:38.000000000 +0200
+++ linux-2.6.22-rc4/kernel/rtmutex.c 2007-06-08 01:39:38.000000000 +0200
@@ -636,9 +636,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;
}
--
next prev parent reply other threads:[~2007-06-08 0:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-08 0:29 [patch 0/4] PI-Futex bugfixes and cleanups Thomas Gleixner
2007-06-08 0:29 ` Thomas Gleixner [this message]
2007-06-08 7:20 ` [patch 1/4] rt-mutex: Fix stale return value Ingo Molnar
2007-06-08 0:29 ` [patch 2/4] rt-mutex: Fix chain walk early wakeup bug Thomas Gleixner
2007-06-08 7:18 ` Ingo Molnar
2007-06-08 0:29 ` [patch 3/4] pi-futex: Fix exit races and locking problems Thomas Gleixner
2007-06-08 7:16 ` Ingo Molnar
2007-06-08 0:29 ` [patch 4/4] FUTEX: Tidy up the code Thomas Gleixner
2007-06-08 7:10 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070607235801.429050000@linutronix.de \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=drepper@redhat.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox