mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
perfcounters: fix refcounting bug, take 2
Only free child_counter if it has a parent; if it doesn't, then it has a file pointing to it and we'll free it in perf_release. Signed-off-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
5af759176c
commit
4bcf349a0f
1 changed files with 4 additions and 5 deletions
|
@ -1958,14 +1958,13 @@ __perf_counter_exit_task(struct task_struct *child,
|
|||
sync_child_counter(child_counter, parent_counter);
|
||||
list_for_each_entry_safe(sub, tmp, &child_counter->sibling_list,
|
||||
list_entry) {
|
||||
if (sub->parent)
|
||||
if (sub->parent) {
|
||||
sync_child_counter(sub, sub->parent);
|
||||
kfree(sub);
|
||||
kfree(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!child_counter->filp || !atomic_long_read(&child_counter->filp->f_count))
|
||||
kfree(child_counter);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue