* [PATCH v3] perf util: Fix use after free in metric__new
@ 2022-01-07 18:21 José Expósito
0 siblings, 0 replies; only message in thread
From: José Expósito @ 2022-01-07 18:21 UTC (permalink / raw)
To: peterz
Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
irogers, ak, john.garry, linux-perf-users, linux-kernel,
José Expósito
Fix a use after free on the error branch accessing the "metric" struct.
Fixes: b85a4d61d302 (perf metric: Allow modifiers on metrics)
Addresses-Coverity-ID: 1494000
Acked-by: Ian Rogers <irogers@google.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
v2: Add Fixes and Acked-by tags (thanks to Ian Rogers)
v3: Add Reviewed-by tag (thanks to John Garry)
Improve patch description
---
tools/perf/util/metricgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index fffe02aae3ed..4d2fed3aefd1 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -209,8 +209,8 @@ static struct metric *metric__new(const struct pmu_event *pe,
m->metric_name = pe->metric_name;
m->modifier = modifier ? strdup(modifier) : NULL;
if (modifier && !m->modifier) {
- free(m);
expr__ctx_free(m->pctx);
+ free(m);
return NULL;
}
m->metric_expr = pe->metric_expr;
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-07 18:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 18:21 [PATCH v3] perf util: Fix use after free in metric__new José Expósito
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.