|
@@ -4447,6 +4447,9 @@ static void _free_event(struct perf_event *event)
|
|
|
if (event->ctx)
|
|
|
put_ctx(event->ctx);
|
|
|
|
|
|
+ if (event->hw.target)
|
|
|
+ put_task_struct(event->hw.target);
|
|
|
+
|
|
|
exclusive_event_destroy(event);
|
|
|
module_put(event->pmu->module);
|
|
|
|
|
@@ -9955,6 +9958,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
|
|
|
* and we cannot use the ctx information because we need the
|
|
|
* pmu before we get a ctx.
|
|
|
*/
|
|
|
+ get_task_struct(task);
|
|
|
event->hw.target = task;
|
|
|
}
|
|
|
|
|
@@ -10070,6 +10074,8 @@ err_ns:
|
|
|
perf_detach_cgroup(event);
|
|
|
if (event->ns)
|
|
|
put_pid_ns(event->ns);
|
|
|
+ if (event->hw.target)
|
|
|
+ put_task_struct(event->hw.target);
|
|
|
kfree(event);
|
|
|
|
|
|
return ERR_PTR(err);
|