summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-06-23 11:48:40 +0200
committerWilly Tarreau <w@1wt.eu>2007-08-15 10:02:31 +0200
commitea317f3c75a3ff7316d6abbcfa661df277cf4d98 (patch)
tree15f655da1ddec1f6a30c4e09c36dea843364a13c
parent103f048b6f30360d3251c670b0a6714282ceb2c6 (diff)
[PATCH] FUTEX: Restore the dropped ERSCH fix
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>
-rw-r--r--kernel/futex.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index c93ffbffdde4..99dad33f1d69 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -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;