[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YeGNDskRtgpIFmzU@kernel.org>
Date: Fri, 14 Jan 2022 11:47:42 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: José Expósito <jose.exposito89@...il.com>,
peterz@...radead.org, mingo@...hat.com, mark.rutland@....com,
alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
namhyung@...nel.org, ak@...ux.intel.com, john.garry@...wei.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf util: Fix use after free in metric__new
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@...il.com> wrote:
> >
> > Addresses-Coverity-ID: 1494000
> > Signed-off-by: José Expósito <jose.exposito89@...il.com>
>
> Acked-by: Ian Rogers <irogers@...gle,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
Powered by blists - more mailing lists