Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ac6519b authored by Robert Richter's avatar Robert Richter
Browse files

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: default avatarRobert Richter <robert.richter@amd.com>
parent cbf74cea
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = {
	.notifier_call = module_load_notify,
	.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 sync_start(void)
{
{
	int err;
	int err;
@@ -174,6 +181,7 @@ int sync_start(void)
	profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
	profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
out2:
out2:
	task_handoff_unregister(&task_free_nb);
	task_handoff_unregister(&task_free_nb);
	free_all_tasks();
out1:
out1:
	free_cpumask_var(marked_cpus);
	free_cpumask_var(marked_cpus);
	goto out;
	goto out;
@@ -192,10 +200,7 @@ void sync_stop(void)
	mutex_unlock(&buffer_mutex);
	mutex_unlock(&buffer_mutex);
	flush_cpu_work();
	flush_cpu_work();


	/* make sure we don't leak task structs */
	free_all_tasks();
	process_task_mortuary();
	process_task_mortuary();

	free_cpumask_var(marked_cpus);
	free_cpumask_var(marked_cpus);
}
}