* [PATCH] pi-futex: Validate futex type instead of oopsing
@ 2006-07-06 21:59 Thomas Gleixner
0 siblings, 0 replies; only message in thread
From: Thomas Gleixner @ 2006-07-06 21:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Ingo Molnar, Jakub Jelinek
Calling futex_lock_pi is called with a reference to a non PI futex and
waiters exist already, lookup_pi_state() oopses due to pi_state == NULL.
Check this condition and return -EINVAL to userspace.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/kernel/futex.c b/kernel/futex.c
index 1dc98e4..cf0c8e2 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -476,6 +476,12 @@ lookup_pi_state(u32 uval, struct futex_h
* the refcount and return its pi_state:
*/
pi_state = this->pi_state;
+ /*
+ * Userspace might have messed up non PI and PI futexes
+ */
+ if (unlikely(!pi_state))
+ return -EINVAL;
+
atomic_inc(&pi_state->refcount);
me->pi_state = pi_state;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-07-06 21:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-06 21:59 [PATCH] pi-futex: Validate futex type instead of oopsing Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®