* [PATCH] perf util: Fix use after free in metric__new
@ 2021-12-08 17:11 José Expósito
2021-12-08 17:33 ` Ian Rogers
2022-01-14 14:45 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 6+ messages in thread
From: José Expósito @ 2021-12-08 17:11 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
Addresses-Coverity-ID: 1494000
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
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] 6+ messages in thread
* Re: [PATCH] perf util: Fix use after free in metric__new
2021-12-08 17:11 [PATCH] perf util: Fix use after free in metric__new José Expósito
@ 2021-12-08 17:33 ` Ian Rogers
2022-01-14 14:47 ` Arnaldo Carvalho de Melo
2022-01-14 14:45 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2021-12-08 17:33 UTC (permalink / raw)
To: José Expósito
Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, ak, john.garry, linux-perf-users, linux-kernel
On Wed, Dec 8, 2021 at 9:11 AM José Expósito <jose.exposito89@gmail.com> wrote:
>
> Addresses-Coverity-ID: 1494000
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
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)
Thanks,
Ian
> ---
> 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 [flat|nested] 6+ messages in thread
* Re: [PATCH] perf util: Fix use after free in metric__new
2021-12-08 17:11 [PATCH] perf util: Fix use after free in metric__new José Expósito
2021-12-08 17:33 ` Ian Rogers
@ 2022-01-14 14:45 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-14 14:45 UTC (permalink / raw)
To: José Expósito, Ian Rogers
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
ak, john.garry, linux-perf-users, linux-kernel
Em Wed, Dec 08, 2021 at 06:11:13PM +0100, José Expósito escreveu:
> Addresses-Coverity-ID: 1494000
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Sorry, overlooked this one, now processing.
You forgot to add:
Fixes: b85a4d61d3022608 ("perf metric: Allow modifiers on metrics")
Ian, I'm taking this one, obvious fix.
- Arnaldo
> ---
> 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
--
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf util: Fix use after free in metric__new
2021-12-08 17:33 ` Ian Rogers
@ 2022-01-14 14:47 ` Arnaldo Carvalho de Melo
2022-01-14 14:48 ` John Garry
0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-14 14:47 UTC (permalink / raw)
To: Ian Rogers
Cc: José Expósito, peterz, mingo, mark.rutland,
alexander.shishkin, jolsa, namhyung, ak, john.garry,
linux-perf-users, linux-kernel
Em Wed, Dec 08, 2021 at 09:33:14AM -0800, Ian Rogers escreveu:
> On Wed, Dec 8, 2021 at 9:11 AM José Expósito <jose.exposito89@gmail.com> wrote:
> >
> > Addresses-Coverity-ID: 1494000
> > Signed-off-by: José Expósito <jose.exposito89@gmail.com>
>
> 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
> Thanks,
> Ian
>
> > ---
> > 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
> >
--
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf util: Fix use after free in metric__new
2022-01-14 14:47 ` Arnaldo Carvalho de Melo
@ 2022-01-14 14:48 ` John Garry
2022-01-14 15:00 ` José Expósito
0 siblings, 1 reply; 6+ messages in thread
From: John Garry @ 2022-01-14 14:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers
Cc: José Expósito, peterz, mingo, mark.rutland,
alexander.shishkin, jolsa, namhyung, ak, linux-perf-users,
linux-kernel
On 14/01/2022 14:47, Arnaldo Carvalho de Melo wrote:
>>> Addresses-Coverity-ID: 1494000
>>> Signed-off-by: José Expósito<jose.exposito89@gmail.com>
>> 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
>
Isn't there a v3 out there? Not sure if you noticed...
Cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] perf util: Fix use after free in metric__new
2022-01-14 14:48 ` John Garry
@ 2022-01-14 15:00 ` José Expósito
0 siblings, 0 replies; 6+ messages in thread
From: José Expósito @ 2022-01-14 15:00 UTC (permalink / raw)
To: John Garry
Cc: Arnaldo Carvalho de Melo, Ian Rogers, peterz, mingo,
mark.rutland, alexander.shishkin, jolsa, namhyung, ak,
linux-perf-users, linux-kernel
On Fri, Jan 14, 2022 at 02:48:35PM +0000, John Garry wrote:
> On 14/01/2022 14:47, Arnaldo Carvalho de Melo wrote:
> > > > Addresses-Coverity-ID: 1494000
> > > > Signed-off-by: José Expósito<jose.exposito89@gmail.com>
> > > 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
>
>
> 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:
https://lore.kernel.org/linux-perf-users/20220107182106.138418-1-jose.exposito89@gmail.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-14 15:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 17:11 [PATCH] perf util: Fix use after free in metric__new José Expósito
2021-12-08 17:33 ` Ian Rogers
2022-01-14 14:47 ` Arnaldo Carvalho de Melo
2022-01-14 14:48 ` John Garry
2022-01-14 15:00 ` José Expósito
2022-01-14 14:45 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).