diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-05-25 08:45:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-25 08:55:01 -0400 |
commit | 6ab423e0eaca827fbd201ca4ae7d4f8573a366b2 (patch) | |
tree | 072d227934bf213adf5c0dd022369e14f273dc48 /kernel/fork.c | |
parent | 771d7cde144d87f2d1fbee4da3c6234d61f7e42a (diff) |
perf_counter: Propagate inheritance failures down the fork() path
Fail fork() when we fail inheritance for some reason (-ENOMEM most likely).
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <20090525124600.324656474@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 675e01e9072a..c07c3335ceac 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1095,7 +1095,10 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1095 | 1095 | ||
1096 | /* Perform scheduler related setup. Assign this task to a CPU. */ | 1096 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
1097 | sched_fork(p, clone_flags); | 1097 | sched_fork(p, clone_flags); |
1098 | perf_counter_init_task(p); | 1098 | |
1099 | retval = perf_counter_init_task(p); | ||
1100 | if (retval) | ||
1101 | goto bad_fork_cleanup_policy; | ||
1099 | 1102 | ||
1100 | if ((retval = audit_alloc(p))) | 1103 | if ((retval = audit_alloc(p))) |
1101 | goto bad_fork_cleanup_policy; | 1104 | goto bad_fork_cleanup_policy; |
@@ -1295,6 +1298,7 @@ bad_fork_cleanup_semundo: | |||
1295 | bad_fork_cleanup_audit: | 1298 | bad_fork_cleanup_audit: |
1296 | audit_free(p); | 1299 | audit_free(p); |
1297 | bad_fork_cleanup_policy: | 1300 | bad_fork_cleanup_policy: |
1301 | perf_counter_exit_task(p); | ||
1298 | #ifdef CONFIG_NUMA | 1302 | #ifdef CONFIG_NUMA |
1299 | mpol_put(p->mempolicy); | 1303 | mpol_put(p->mempolicy); |
1300 | bad_fork_cleanup_cgroup: | 1304 | bad_fork_cleanup_cgroup: |