mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] FUTEX: Restore the dropped ERSCH fix
@ 2007-06-23  9:48 Thomas Gleixner
  2007-06-23 10:00 ` [PATCH -mm] FUTEX: Tidy up the code - V2 Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Gleixner @ 2007-06-23  9:48 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Ingo Molnar, Stable Team, LKML, Ulrich Drepper

The return value of futex_find_get_task() needs to be -ESRCH in case
that the search fails. This was part of the original futex fixes and 
got accidentally dropped, when the futex-tidy-up patch was split out.

Results in a NULL pointer dereference in case the search fails.

Restore it.

Please apply also to 2.6.21 stable

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Stable Team <stable@kernel.org>

---
 kernel/futex.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Index: linux-2.6/kernel/futex.c
===================================================================
--- linux-2.6.orig/kernel/futex.c	2007-06-23 11:39:20.000000000 +0200
+++ linux-2.6/kernel/futex.c	2007-06-23 11:39:20.000000000 +0200
@@ -409,14 +409,12 @@ static struct task_struct * futex_find_g
 
 	rcu_read_lock();
 	p = find_task_by_pid(pid);
-	if (!p)
-		goto out_unlock;
-	if ((current->euid != p->euid) && (current->euid != p->uid)) {
-		p = NULL;
-		goto out_unlock;
-	}
-	get_task_struct(p);
-out_unlock:
+
+	if (!p || ((current->euid != p->euid) && (current->euid != p->uid)))
+		p = ERR_PTR(-ESRCH);
+	else
+		get_task_struct(p);
+
 	rcu_read_unlock();
 
 	return p;



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

end of thread, other threads:[~2007-06-23 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-23  9:48 [PATCH] FUTEX: Restore the dropped ERSCH fix Thomas Gleixner
2007-06-23 10:00 ` [PATCH -mm] FUTEX: Tidy up the code - V2 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®