Skip to content

Commit

Permalink
perf core: Return error pointer if inherit_event() fails to find pmu_ctx
Browse files Browse the repository at this point in the history
inherit_event() returns NULL only when it finds orphaned events
otherwise it returns either valid child_event pointer or an error
pointer. Follow the same when it fails to find pmu_ctx.

Fixes: bd27568 ("perf: Rewrite core context handling")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20221118051539.820-1-ravi.bangoria@amd.com
  • Loading branch information
Ravi Bangoria authored and Peter Zijlstra committed Dec 27, 2022
1 parent 1b929c0 commit e2d3714
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13231,7 +13231,7 @@ inherit_event(struct perf_event *parent_event,
pmu_ctx = find_get_pmu_context(child_event->pmu, child_ctx, child_event);
if (IS_ERR(pmu_ctx)) {
free_event(child_event);
return NULL;
return ERR_CAST(pmu_ctx);
}
child_event->pmu_ctx = pmu_ctx;

Expand Down

0 comments on commit e2d3714

Please sign in to comment.