* [PATCH] perf_events: fix invalid pointer when pid is invalid
@ 2010-10-04 10:00 Stephane Eranian
2010-10-04 20:35 ` [tip:perf/core] perf_events: Fix " tip-bot for Stephane Eranian
0 siblings, 1 reply; 2+ messages in thread
From: Stephane Eranian @ 2010-10-04 10:00 UTC (permalink / raw)
To: linux-kernel
Cc: peterz, mingo, paulus, davem, fweisbec, perfmon2-devel, eranian,
eranian, robert.richter
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@google.com>
---
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):
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:perf/core] perf_events: Fix invalid pointer when pid is invalid
2010-10-04 10:00 [PATCH] perf_events: fix invalid pointer when pid is invalid Stephane Eranian
@ 2010-10-04 20:35 ` tip-bot for Stephane Eranian
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Stephane Eranian @ 2010-10-04 20:35 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, eranian, hpa, mingo, tglx, mingo
Commit-ID: 540804b5c52065a87d826f7714b18a3ec0b269f9
Gitweb: http://git.kernel.org/tip/540804b5c52065a87d826f7714b18a3ec0b269f9
Author: Stephane Eranian <eranian@google.com>
AuthorDate: Mon, 4 Oct 2010 12:00:02 +0200
Committer: Ingo Molnar <mingo@elte.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@google.com>
Cc: peterz@infradead.org
Cc: paulus@samba.org
Cc: davem@davemloft.net
Cc: fweisbec@gmail.com
Cc: perfmon2-devel@lists.sf.net
Cc: eranian@gmail.com
Cc: robert.richter@amd.com
LKML-Reference: <4ca9a5d1.e8e9d80a.3dbb.ffff8f2e@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.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):
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-04 20:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-04 10:00 [PATCH] perf_events: fix invalid pointer when pid is invalid Stephane Eranian
2010-10-04 20:35 ` [tip:perf/core] perf_events: Fix " tip-bot for Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome