perf util: Fix use after free in metric__new
PATCH 1/1 perf util: Fix use after free in metric__new
Addresses-Coverity-ID: 1494000
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/metricgroup.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
Quoted 3 lines · José Expósito
Addresses-Coverity-ID: 1494000
Signed-off-by José Expósito <[email protected]>
This can only happen in the ENOMEM case, but it is a good fix.
Thanks,
Ian
Quoted 21 lines
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/metricgroup.c +1
-2@@ -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
Arnaldo Carvalho de Melo
maintainerEm Wed, Dec 08, 2021 at 09:33:14AM -0800, Ian Rogers escreveu:
Quoted 10 lines · José Expósito
Quoted 3 lines
Addresses-Coverity-ID: 1494000
Signed-off-by José Expósito <[email protected]>Acked-by Ian Rogers <irogers@google,com>This can only happen in the ENOMEM case, but it is a good fix.
Fixes b85a4d61d302 (perf metric: Allow modifiers on metrics)
Sorry, I missed this one _as well_, sigh...
- Arnaldo
Quoted 24 lines
Thanks,
IanQuoted 21 lines
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/metricgroup.c +1
-2@@ -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
Signature · 1 line
- Arnaldo
Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 7 lines
Quoted 2 lines
Addresses-Coverity-ID: 1494000
Signed-off-by José Expósito<[email protected]>Acked-by Ian Rogers <irogers@google,com>This can only happen in the ENOMEM case, but it is a good fix.
Fixes b85a4d61d302 (perf metric: Allow modifiers on metrics)Sorry, I missed this
one_aswell_, sigh...- Arnaldo
Isn't there a v3 out there? Not sure if you noticed...
Cheers
Quoted 8 lines · John Garry
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 7 lines
Quoted 2 lines
Addresses-Coverity-ID: 1494000
Signed-off-by José Expósito<[email protected]>Acked-by Ian Rogers <irogers@google,com>This can only happen in the ENOMEM case, but it is a good fix.
Fixes b85a4d61d302 (perf metric: Allow modifiers on metrics)
Quoted 8 lines
Quoted 3 lines
Sorry, I missed this
one_aswell_, sigh...- Arnaldo
Isn't there a v3 out there? Not sure if you noticed...
Cheers
Yes, here is v3 including the Fixes, Acked-by and Reviewed-by tags:
Arnaldo Carvalho de Melo
maintainerEm Wed, Dec 08, 2021 at 06:11:13PM +0100, José Expósito escreveu:
Quoted 2 lines
Addresses-Coverity-ID: 1494000
Signed-off-by José Expósito <[email protected]>
Sorry, overlooked this one, now processing.
You forgot to add:
Ian, I'm taking this one, obvious fix.
- Arnaldo
Quoted 20 lines
--- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/metricgroup.c +1
-1@@ -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;Signature · 1 line
2.25.1
Signature · 1 line
- Arnaldo