Skip to content

Commit 697d877

Browse files
virtuosoIngo Molnar
authored andcommitted
perf/core: Consistently fail fork on allocation failures
Commit: 313ccb9 ("perf: Allocate context task_ctx_data for child event") makes the inherit path skip over the current event in case of task_ctx_data allocation failure. This, however, is inconsistent with allocation failures in perf_event_alloc(), which would abort the fork. Correct this by returning an error code on task_ctx_data allocation failure and failing the fork in that case. Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent dce5aff commit 697d877

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11802,7 +11802,7 @@ inherit_event(struct perf_event *parent_event,
1180211802
GFP_KERNEL);
1180311803
if (!child_ctx->task_ctx_data) {
1180411804
free_event(child_event);
11805-
return NULL;
11805+
return ERR_PTR(-ENOMEM);
1180611806
}
1180711807
}
1180811808

0 commit comments

Comments
 (0)