Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp119863ybg; Mon, 8 Jun 2020 18:09:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXHqMs8yyBw2ymxEI3hO+g+GwqtHNdVnGl8kqO8tbhmaQrBugv2B77BEqPcwAIWKzA7yug X-Received: by 2002:a50:ed08:: with SMTP id j8mr24635693eds.58.1591664999274; Mon, 08 Jun 2020 18:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664999; cv=none; d=google.com; s=arc-20160816; b=FPcxEDv1ApyODfEDbC7xtUv5SKXfhogu8qgIyAxcAgH1aPBqRbI3EiFHH4xh3Agp5B EaGqygiaLZ1txB4vVSmgAT2zXSPKj1eZbQneuRUFQrB9zrYPrcN+bNp4+4WJchxF5Zp/ mhG2P9UyEKzZmxK/xcIAFtm7gPLtnMM8VDZs5J1KrLW67ZrPvfdWfFNFNFaDTUPc1kzn sJMuuS8UyGc47V0bHB21ACUcBx2+UJlzwoAm+jS28rHL/74FeSImUcELD3DwPxpkDh+a l10ozinRDF0cEZadUnrzs9c5x9j+5O1RkPTvHAK5rcLPI6WAKwS7wursWwVzR/tuPXh8 TnHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5z6oUQUFJi4XLJFHhW6waptr8eRFF81B2QK1O+gYOjQ=; b=owjbAK1h4Wb6qXb3vKQ3kq3lP4XpmR+Xw68MZ8ZhWR85oYJ8U9SLfRY5ztOI0MuPTJ g3z91eR11/LHhkLEoIRf/6uzc/+bhcuQm0cKjea265mAtlsWd6d/K4oPBqwdsk7HdNua Pb0UZTH0+RZbG77Yr5hbkHh/LHJl4gTnf38QLfEuRcRldDP0n2evjJ5+6bIdY+/ITvQb LNzDcSl1T8/Ndr6sXvRP8YwO2+lBuwvSsxuaGxyRejcnkpQo4UusizkVM+PyHWlgkdrw tDw7kdifoEg6w8nTY7jnU+glEHcgGmLtrhXPzQ2WUibC0YTMC5te3/yXi8lpaimEaQAv MK1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qL9QQlEm; 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 g30si10542022ede.28.2020.06.08.18.09.30; Mon, 08 Jun 2020 18:09:59 -0700 (PDT) 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=default header.b=qL9QQlEm; 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 S1731203AbgFIBHt (ORCPT + 99 others); Mon, 8 Jun 2020 21:07:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727083AbgFHXGv (ORCPT ); Mon, 8 Jun 2020 19:06:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD9AA20899; Mon, 8 Jun 2020 23:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657611; bh=hqTYac1zqlyJDPaAEG6Fyc+y1JupKz26eb4ITX31SLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qL9QQlEmfv3vOL6mvxYvJqjXNwS46nVaOleZoUjHY55hUI1gJjGELrOFs/UPHKglK B+uK3qIblBN0GBKVwegKjKI0DvKgtFUdj3L6vAg5Z6ksQeR+lx+sWdiCOvXY3VXepN Spq/Ze2tIPiRnOMGvrQDhtPBLVeNA0jZhLtkpLjo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: 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 AUTOSEL 5.7 034/274] libperf evlist: Fix a refcount leak Date: Mon, 8 Jun 2020 19:02:07 -0400 Message-Id: <20200608230607.3361041-34-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.25.1