aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-05-26 12:22:54 -0400
committerRobert Richter <robert.richter@amd.com>2011-05-31 10:33:33 -0400
commit6ac6519b93065625119a347be1cbcc1b89edb773 (patch)
tree673965e52a026d00685e36105b45f74086c1f38c /drivers/oprofile
parentcbf74cea070fa1f705de4712e25d9e56ae6543c7 (diff)
oprofile: Free potentially owned tasks in case of errors
After registering the task free notifier we possibly have tasks in our dying_tasks list. Free them after unregistering the notifier in case of an error. Cc: <stable@kernel.org> # .36+ Signed-off-by: Robert Richter <robert.richter@amd.com>
Diffstat (limited to 'drivers/oprofile')
-rw-r--r--drivers/oprofile/buffer_sync.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index a3984f4ef192..04250aa16f51 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = {
141 .notifier_call = module_load_notify, 141 .notifier_call = module_load_notify,
142}; 142};
143 143
144static void free_all_tasks(void)
145{
146 /* make sure we don't leak task structs */
147 process_task_mortuary();
148 process_task_mortuary();
149}
150
144int sync_start(void) 151int sync_start(void)
145{ 152{
146 int err; 153 int err;
@@ -174,6 +181,7 @@ out3:
174 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); 181 profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
175out2: 182out2:
176 task_handoff_unregister(&task_free_nb); 183 task_handoff_unregister(&task_free_nb);
184 free_all_tasks();
177out1: 185out1:
178 free_cpumask_var(marked_cpus); 186 free_cpumask_var(marked_cpus);
179 goto out; 187 goto out;
@@ -192,10 +200,7 @@ void sync_stop(void)
192 mutex_unlock(&buffer_mutex); 200 mutex_unlock(&buffer_mutex);
193 flush_cpu_work(); 201 flush_cpu_work();
194 202
195 /* make sure we don't leak task structs */ 203 free_all_tasks();
196 process_task_mortuary();
197 process_task_mortuary();
198
199 free_cpumask_var(marked_cpus); 204 free_cpumask_var(marked_cpus);
200} 205}
201 206