From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, paulus@samba.org,
davem@davemloft.net, fweisbec@gmail.com,
perfmon2-devel@lists.sf.net, eranian@gmail.com,
eranian@google.com, robert.richter@amd.com
Subject: [PATCH] perf_events: fix NULL point in free_event()
Date: Mon, 13 Sep 2010 16:36:01 +0200 [thread overview]
Message-ID: <4c8e3766.991ce30a.32cd.fffff5f0@mx.google.com> (raw)
Without the following patch, perf top as non-root and
paranoid cpu set causes a NULL pointer dereference in
free_event() because event->ctx is NULL.
free_event() may be called, on the error path, before
event->ctx is set.
Signed-off-by: Stephane Eranian <eranian@google.com>
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f29b525..a7d5e7a 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2150,7 +2150,8 @@ static void free_event(struct perf_event *event)
if (event->destroy)
event->destroy(event);
- put_ctx(event->ctx);
+ if (event->ctx)
+ put_ctx(event->ctx);
call_rcu(&event->rcu_head, free_event_rcu);
}
next reply other threads:[~2010-09-13 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 14:36 Stephane Eranian [this message]
2010-09-13 14:55 ` [PATCH] perf_events: fix NULL point in free_event() Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c8e3766.991ce30a.32cd.fffff5f0@mx.google.com \
--to=eranian@google.com \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.