From patchwork Fri Jun 19 14:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 224107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8440BC433E0 for ; Fri, 19 Jun 2020 15:17:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B16D2158C for ; Fri, 19 Jun 2020 15:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579863; bh=hqTYac1zqlyJDPaAEG6Fyc+y1JupKz26eb4ITX31SLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EdQvC88rK6e1Ff/E+IihErItUY9fLgBPEfe/wlp6mrdxnrDM4k7IwXhf/19wYYedx zqldIuSvZHFyrfr/wRVpDoaw72RxYRSwnEuaQKO1YMh1xKlbH7E8oAvTtMkBbqERYB ZchjUN+31CCy5kKg88I8usAgmHgBH5Bq68Wbo5bQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392525AbgFSPRl (ORCPT ); Fri, 19 Jun 2020 11:17:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:48282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392519AbgFSPRk (ORCPT ); Fri, 19 Jun 2020 11:17:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FC95206DB; Fri, 19 Jun 2020 15:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579860; bh=hqTYac1zqlyJDPaAEG6Fyc+y1JupKz26eb4ITX31SLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=leAzHyOg79VsEBrn36ZVAbjeL+th7yduoQ4LEz2gBaI3hGjg93TLqhsHSur8xs+2Q k0WzeiJNqR+BFtm+H/XadjZyEkqORT28a5jjQMZSUaycJPf6MFBXfrmVgwYiOsftES +g2YRFMSL3Z0Ddni8CvpcGiqVGRL93SULRQ5vUyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Adrian Hunter , Alexander Shishkin , Andi Kleen , Jiri Olsa , Leo Yan , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , clang-built-linux@googlegroups.com, Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.7 032/376] libperf evlist: Fix a refcount leak Date: Fri, 19 Jun 2020 16:29:10 +0200 Message-Id: <20200619141711.872753519@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ian Rogers [ Upstream commit 4599d292128d89e4cf866a0ea9a9b047a2de8418 ] Memory leaks found by applying LLVM's libfuzzer on the tools/perf parse_events function. Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Cc: clang-built-linux@googlegroups.com Link: http://lore.kernel.org/lkml/20200319023101.82458-2-irogers@google.com [ Did a minor adjustment due to some other previous patch having already set evlist->all_cpus to NULL at perf_evlist__exit() ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/lib/perf/evlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index 5b9f2ca50591..62130d28652d 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -125,6 +125,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist) void perf_evlist__exit(struct perf_evlist *evlist) { perf_cpu_map__put(evlist->cpus); + perf_cpu_map__put(evlist->all_cpus); perf_thread_map__put(evlist->threads); evlist->cpus = NULL; evlist->threads = NULL;