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 <eran...@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);
 }
 

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to