Commit 9cb627d5 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

perf, trace: Fix module leak

Commit 1c024eca (perf, trace: Optimize tracepoints by using
per-tracepoint-per-cpu hlist to track events) caused a module
refcount leak.
Reported-And-Tested-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4C7E1F12.8030304@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent da34634f
...@@ -91,6 +91,8 @@ int perf_trace_init(struct perf_event *p_event) ...@@ -91,6 +91,8 @@ int perf_trace_init(struct perf_event *p_event)
tp_event->class && tp_event->class->reg && tp_event->class && tp_event->class->reg &&
try_module_get(tp_event->mod)) { try_module_get(tp_event->mod)) {
ret = perf_trace_event_init(tp_event, p_event); ret = perf_trace_event_init(tp_event, p_event);
if (ret)
module_put(tp_event->mod);
break; break;
} }
} }
...@@ -146,6 +148,7 @@ void perf_trace_destroy(struct perf_event *p_event) ...@@ -146,6 +148,7 @@ void perf_trace_destroy(struct perf_event *p_event)
} }
} }
out: out:
module_put(tp_event->mod);
mutex_unlock(&event_mutex); mutex_unlock(&event_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment