lkml.org 
[lkml]   [2010]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/5] perf: Support disable() after stop() on software events
    Date
    If we call perf_event_stop() on a software event and then the
    disable() pmu callback on them after that, we'll call twice
    hlist_del_rcu() on the same hlist node and then bring a crash
    by dereferencing LIST_POISON2.

    Just use hlist_del_init_rcu() instead to fix this problem.

    This preparates for new context exclusions.

    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Cyrill Gorcunov <gorcunov@gmail.com>
    Cc: Zhang Yanmin <yanmin_zhang@linux.intel.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    ---
    kernel/perf_event.c | 2 +-
    kernel/trace/trace_event_perf.c | 2 +-
    2 files changed, 2 insertions(+), 2 deletions(-)

    diff --git a/kernel/perf_event.c b/kernel/perf_event.c
    index 95a56ed..c5f2306 100644
    --- a/kernel/perf_event.c
    +++ b/kernel/perf_event.c
    @@ -4292,7 +4292,7 @@ static int perf_swevent_enable(struct perf_event *event)

    static void perf_swevent_disable(struct perf_event *event)
    {
    - hlist_del_rcu(&event->hlist_entry);
    + hlist_del_init_rcu(&event->hlist_entry);
    }

    static void perf_swevent_void(struct perf_event *event)
    diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
    index 4799d70..7bc1f26 100644
    --- a/kernel/trace/trace_event_perf.c
    +++ b/kernel/trace/trace_event_perf.c
    @@ -122,7 +122,7 @@ int perf_trace_enable(struct perf_event *p_event)

    void perf_trace_disable(struct perf_event *p_event)
    {
    - hlist_del_rcu(&p_event->hlist_entry);
    + hlist_del_init_rcu(&p_event->hlist_entry);
    }

    void perf_trace_destroy(struct perf_event *p_event)
    --
    1.6.2.3


    \
     
     \ /
      Last update: 2010-06-12 09:39    [W:0.023 / U:0.956 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site