diff options
| -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 | ||
