All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] futex: add WARN_ON to catch certain assymetric (get|put)_futex_key calls
@ 2008-12-30  3:43 Darren Hart
  2008-12-30  5:42 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart @ 2008-12-30  3:43 UTC (permalink / raw)
  To: Ingo Molnar, linux-kernel
  Cc: Darren Hart, Peter Zijlstra, Thomas Gleixner, Rusty Russell

Following up on my previous key reference accounting patches, this patch
will catch puts on keys that haven't been "got".  This won't catch nested
get/put mismatches though.

Build and boot tested, with minimal desktop activity and a run of the
open_posix_testsuite in LTP for testing.  No warnings logged.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>
Cc: "Thomas Gleixner" <tglx@linutronix.de>
Cc: "Rusty Russell" <rusty@au1.ibm.com>
---

 kernel/futex.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 748778a..5288acf 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -170,8 +170,11 @@ static void get_futex_key_refs(union futex_key *key)
  */
 static void drop_futex_key_refs(union futex_key *key)
 {
-	if (!key->both.ptr)
+	if (!key->both.ptr) {
+		/* If we're here then we tried to put a key we failed to get */
+		WARN_ON(1);
 		return;
+	}
 
 	switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
 	case FUT_OFF_INODE:


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-30  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-30  3:43 [PATCH] futex: add WARN_ON to catch certain assymetric (get|put)_futex_key calls Darren Hart
2008-12-30  5:42 ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.