summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRobert Richter <robert.richter@amd.com>2011-05-26 18:22:54 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-23 15:05:39 -0700
commit409dbd2f927fe65ffad9eb57253abded37ed1905 (patch)
tree67814ac32ac9b1f914a3c17a189f0fe2c80fa545 /drivers
parentf94e820b157193b5b518aa891f5f19da5c9ab395 (diff)
oprofile: Free potentially owned tasks in case of errors
commit 6ac6519b93065625119a347be1cbcc1b89edb773 upstream. 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. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-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 = {
.notifier_call = module_load_notify,
};
+static void free_all_tasks(void)
+{
+ /* make sure we don't leak task structs */
+ process_task_mortuary();
+ process_task_mortuary();
+}
+
int sync_start(void)
{
int err;
@@ -174,6 +181,7 @@ out3:
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
out2:
task_handoff_unregister(&task_free_nb);
+ free_all_tasks();
out1:
free_cpumask_var(marked_cpus);
goto out;
@@ -192,10 +200,7 @@ void sync_stop(void)
mutex_unlock(&buffer_mutex);
flush_cpu_work();
- /* make sure we don't leak task structs */
- process_task_mortuary();
- process_task_mortuary();
-
+ free_all_tasks();
free_cpumask_var(marked_cpus);
}