lkml.org 
[lkml]   [2010]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: ftrace/perf_event leak
    From
    Date
    On Wed, 2010-09-01 at 17:38 +0800, Li Zefan wrote:

    > ---
    > diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
    > index 8a2b73f..9d1d1f2 100644
    > --- a/kernel/trace/trace_event_perf.c
    > +++ b/kernel/trace/trace_event_perf.c
    > @@ -161,6 +161,7 @@ void perf_trace_destroy(struct perf_event *p_event)
    > }
    > }
    > out:
    > + module_put(tp_event->mod);
    > mutex_unlock(&event_mutex);
    > }

    Ah, indeed, we so that try_module_get() for each reference to the
    tracepoint, I guess we also should do the below, in case the
    registration fails.

    diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
    index 000e6e8..31cc4cb 100644
    --- a/kernel/trace/trace_event_perf.c
    +++ b/kernel/trace/trace_event_perf.c
    @@ -91,6 +91,8 @@ int perf_trace_init(struct perf_event *p_event)
    tp_event->class && tp_event->class->reg &&
    try_module_get(tp_event->mod)) {
    ret = perf_trace_event_init(tp_event, p_event);
    + if (ret)
    + module_put(tp_event->mod);
    break;
    }
    }

    \
     
     \ /
      Last update: 2010-09-01 11:43    [W:0.022 / U:91.420 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site