[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221118051539.820-1-ravi.bangoria@amd.com>
Date: Fri, 18 Nov 2022 10:45:39 +0530
From: Ravi Bangoria <ravi.bangoria@....com>
To: <peterz@...radead.org>
CC: <ravi.bangoria@....com>, <acme@...nel.org>, <mark.rutland@....com>,
<jolsa@...hat.com>, <namhyung@...nel.org>, <error27@...il.com>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<sandipan.das@....com>, <ananth.narayan@....com>,
<santosh.shukla@....com>
Subject: [PATCH] perf core: Return error pointer if inherit_event() fails to find pmu_ctx
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.
Reported-by: Dan Carpenter <error27@...il.com>
Fixes: bd2756811766 ("perf: Rewrite core context handling")
Signed-off-by: Ravi Bangoria <ravi.bangoria@....com>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5f262f91cd31..ce75288cdbae 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -13175,7 +13175,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;
--
2.37.3
Powered by blists - more mailing lists