aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2009-02-11 07:53:19 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-11 08:08:44 -0500
commit4bcf349a0f90d1e69eb35c6df0fa285c886c1cd6 (patch)
tree11d4d39799d72e9d3de0e6b6546f5055479f3136 /kernel/perf_counter.c
parent5af759176cc767e7426f89764bde4996ebaaf419 (diff)
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>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index e0576c3fdb50..fcefb0a726f3 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1958,14 +1958,13 @@ __perf_counter_exit_task(struct task_struct *child,
1958 sync_child_counter(child_counter, parent_counter); 1958 sync_child_counter(child_counter, parent_counter);
1959 list_for_each_entry_safe(sub, tmp, &child_counter->sibling_list, 1959 list_for_each_entry_safe(sub, tmp, &child_counter->sibling_list,
1960 list_entry) { 1960 list_entry) {
1961 if (sub->parent) 1961 if (sub->parent) {
1962 sync_child_counter(sub, sub->parent); 1962 sync_child_counter(sub, sub->parent);
1963 kfree(sub); 1963 kfree(sub);
1964 }
1964 } 1965 }
1965 }
1966
1967 if (!child_counter->filp || !atomic_long_read(&child_counter->filp->f_count))
1968 kfree(child_counter); 1966 kfree(child_counter);
1967 }
1969} 1968}
1970 1969
1971/* 1970/*