[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c8e3766.991ce30a.32cd.fffff5f0@mx.google.com>
Date: Mon, 13 Sep 2010 16:36:01 +0200
From: Stephane Eranian <eranian@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, mingo@...e.hu, paulus@...ba.org,
davem@...emloft.net, fweisbec@...il.com,
perfmon2-devel@...ts.sf.net, eranian@...il.com, eranian@...gle.com,
robert.richter@....com
Subject: [PATCH] perf_events: fix NULL point in free_event()
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@...gle.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);
}
--
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