]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
FUTEX: Restore the dropped ERSCH fix
authorThomas Gleixner <tglx@linutronix.de>
Sat, 23 Jun 2007 09:48:40 +0000 (11:48 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 4 Aug 2007 16:10:25 +0000 (09:10 -0700)
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/futex.c

index c132532b2eedda6020450948c21986920987890c..480943687456915a19073d8f86fa898dc537f07b 100644 (file)
@@ -390,14 +390,12 @@ static struct task_struct * futex_find_get_task(pid_t pid)
 
        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;