Skip to content

Commit

Permalink
oprofile: Free potentially owned tasks in case of errors
Browse files Browse the repository at this point in the history
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: <[email protected]> # .36+
Signed-off-by: Robert Richter <[email protected]>
  • Loading branch information
Robert Richter committed May 31, 2011
1 parent cbf74ce commit 6ac6519
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -174,6 +181,7 @@ int sync_start(void)
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;
Expand All @@ -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);
}

Expand Down

0 comments on commit 6ac6519

Please sign in to comment.