Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp666665pxb; Fri, 14 Jan 2022 13:33:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJylgIrzGIz6gh8RV7Pa3QnCQBcXT7b4Cp3ASC6DZPuuCjhe+PWX2oI2FFp2t5YV79Wg0UbP X-Received: by 2002:a63:7203:: with SMTP id n3mr9601965pgc.122.1642196036746; Fri, 14 Jan 2022 13:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642196036; cv=none; d=google.com; s=arc-20160816; b=TgRiN1XyUGuAb/dGHWRXbPewZIrvFkbY1op8IbVAZw0p/7KgzjlD9jtuMgVzgGao4v 0vueXsj+7chdLVtkN/JVxuIWU/WtbIH0eSuMoGfVbjBfSyJ8WhtY6WjPQFIMVWwgZjBv /M/9kgL1WbqcmrTVjdxbfrlsDU8Q7zWEBjK9RPkSIyDQ34XpFfDRaluyZ7F0shwMGNUj CLGu3qd5Q8bOd7g/GAIf7w8IrgBEbkDUjhN/Qa5OrXYJApwYbVW0GJl7scnnz1cWLJr6 lmmHTKKEFDGsEt8xA40KsMQ4nSJ6wxdr33r7wJr1gBYWMSP+XE0bbkxBlkE/jb/aJ7QM tr2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iMGD0acsWubbrHiiN6/GlLGc63dSHwJFe8ybn/d6Rlg=; b=vs7FhVFhRsc3WGm7L0aH0f9jITJ6U1Ijd3DWFzybtsubRebFTMrMVKzlK41PJxdP7A yztSs6v+7jCaa16J0AHLAdvk9y0Sdhy7EIceZN19x4/wol+Mn6wQXzAop56rDzOU+1Db R17w4mTbqmv332JJbkSPKwTrgGrPHZhJQEmjw+pb4FnV0CgmtEZ0vOUI582jB4z5Bi/H rbqswHFy1G4OD02UgZmSfK/c74Pp4EYiYgvhtQQi+UiNvtpx9ycsri0LmVbEQ9yH7jBn 1jO8YMU19dJJtcftlZnAJKbU6YORV2CFdagsq4KVPVE7BVzJeQ7QwC5tKOzJH89imW/C /eZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+u88xKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si8294830plh.410.2022.01.14.13.33.45; Fri, 14 Jan 2022 13:33:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j+u88xKt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbiANOqE (ORCPT + 99 others); Fri, 14 Jan 2022 09:46:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241943AbiANOp5 (ORCPT ); Fri, 14 Jan 2022 09:45:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68BC6C06173F; Fri, 14 Jan 2022 06:45:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 27866B82600; Fri, 14 Jan 2022 14:45:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F07C36AE5; Fri, 14 Jan 2022 14:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642171554; bh=TQNaw/3dPJwNIlobkXQRC06IR5ojhEFC4skgtBahSXs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j+u88xKtaAMdmEYr9nnWJ/S7a6ttO+OXKtFGZf4ZjcllMltrBfDe6pL/OHUqcZIZY CRG80k63MbASxiqlrL6Khg174wOXdPbjR2jVXAYnFjCCTETYw8AAvDlDhqnYvdfphc tN7TjUOdx1VS33yq7QHk9lqcRkE4FuLHlHLrOM+M+YvZbd2Ldfa2ZU6jP+P+fYK8wN zW3eI6TxlzdSwAY/JCuMcOzRsZ9PHMKGIZH+FcbuBlVUB6m6EgCawRW4IOhD+nqcPa 3T3pmIM9uo9vK7cQAmJGn0GPzFFjquSX+STlUS8iDFydCW9Rd/v2RmRCkeUn+UdM2Y eCnapuNfDWgIg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id CFDD440714; Fri, 14 Jan 2022 11:45:52 -0300 (-03) Date: Fri, 14 Jan 2022 11:45:52 -0300 From: Arnaldo Carvalho de Melo To: =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= , Ian Rogers Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, ak@linux.intel.com, john.garry@huawei.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf util: Fix use after free in metric__new Message-ID: References: <20211208171113.22089-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211208171113.22089-1-jose.exposito89@gmail.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Dec 08, 2021 at 06:11:13PM +0100, Jos? Exp?sito escreveu: > Addresses-Coverity-ID: 1494000 > Signed-off-by: Jos? Exp?sito 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