[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-540804b5c52065a87d826f7714b18a3ec0b269f9@git.kernel.org>
Date: Mon, 4 Oct 2010 20:35:31 GMT
From: tip-bot for Stephane Eranian <eranian@...gle.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, hpa@...or.com,
mingo@...hat.com, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/core] perf_events: Fix invalid pointer when pid is invalid
Commit-ID: 540804b5c52065a87d826f7714b18a3ec0b269f9
Gitweb: http://git.kernel.org/tip/540804b5c52065a87d826f7714b18a3ec0b269f9
Author: Stephane Eranian <eranian@...gle.com>
AuthorDate: Mon, 4 Oct 2010 12:00:02 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Mon, 4 Oct 2010 12:47:20 +0200
perf_events: Fix invalid pointer when pid is invalid
This patch fixes an error in perf_event_open() when the pid
provided by the user is invalid. find_lively_task_by_vpid()
does not return NULL on error but an error code. Without the
fix the error code was silently passed to find_get_context()
which would eventually cause a invalid pointer dereference.
Signed-off-by: Stephane Eranian <eranian@...gle.com>
Cc: peterz@...radead.org
Cc: paulus@...ba.org
Cc: davem@...emloft.net
Cc: fweisbec@...il.com
Cc: perfmon2-devel@...ts.sf.net
Cc: eranian@...il.com
Cc: robert.richter@....com
LKML-Reference: <4ca9a5d1.e8e9d80a.3dbb.ffff8f2e@...google.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/perf_event.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index c16158c..64507ea 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5616,8 +5616,13 @@ SYSCALL_DEFINE5(perf_event_open,
}
}
- if (pid != -1)
+ if (pid != -1) {
task = find_lively_task_by_vpid(pid);
+ if (IS_ERR(task)) {
+ err = PTR_ERR(task);
+ goto err_group_fd;
+ }
+ }
/*
* Get the target context (task or percpu):
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists