diff options
| author | Robert Richter <robert.richter@amd.com> | 2011-05-26 12:22:54 -0400 |
|---|---|---|
| committer | Robert Richter <robert.richter@amd.com> | 2011-05-31 10:33:33 -0400 |
| commit | 6ac6519b93065625119a347be1cbcc1b89edb773 (patch) | |
| tree | 673965e52a026d00685e36105b45f74086c1f38c | |
| parent | cbf74cea070fa1f705de4712e25d9e56ae6543c7 (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>
| -rw-r--r-- | drivers/oprofile/buffer_sync.c | 13 |
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 | ||
| 144 | static 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 | |||
| 144 | int sync_start(void) | 151 | int 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); |
| 175 | out2: | 182 | out2: |
| 176 | task_handoff_unregister(&task_free_nb); | 183 | task_handoff_unregister(&task_free_nb); |
| 184 | free_all_tasks(); | ||
| 177 | out1: | 185 | out1: |
| 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 | ||
