Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp894548yba; Thu, 18 Apr 2019 11:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx49oARocjhzd0rGJ21hsITo2ERkamfn5HAvGwHGQlmIxZUETmA81t1MkyBhCCozwADZDQ X-Received: by 2002:a17:902:e48f:: with SMTP id cj15mr96459695plb.256.1555611669094; Thu, 18 Apr 2019 11:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611669; cv=none; d=google.com; s=arc-20160816; b=M0bNP/rsTy6qnhvdrv2ZUVmfDcIEWBYG/woZax+ZE7Yqg/hm16eVN8NbBvxnA30WDd Z1rFRIzGyAXUEI3g8NgCUOXnaijDgZC0MCGQwpjVgdbEnJEEqgaGQp9e/+im7spkoHyN vOhQHKqzyPJCDbM6J7dNTfRXti5cnIXfznMzt2Abq1+VwlD3bRHXSZ3CBnwdvhig2oty 2r3Sx65yJ6IZTrHX+39Q5KuNOiojltr/j79OrDoU4OQeGZGZSJboFB9EK58JNmKTpm21 idfgC8lHa+vSm7Rfj/9PpNf9MACocwAevjeh7NqvR1LMcmFBUZYjeMDmwRZ6vbVOzkV1 J1Mg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=utT/apc7xQFzoZhwFegqL/X1k093G/Cnl0YZJVrkao0=; b=JG2UlkMtTze0XDPNZgHLq9zM88bDllV+t/W3uMsUDeiW31Tzi707U9vkOI6EH/Ve/Z D5FSpcpz9wYOQDLizdB9GoVuSQDANQY+1HgN/EFTJ1axkRvYlucJWo7Bffgv3OwEiG2A MhdOiSAPE+sMcXVk1jiSwH5T1eP8Z0jL2OkWumz8YPoi+r6ppCov8KeahgryAamCvXuk 9nzd8shGMHHbHnm76GrS5fiRZeNtZUN+BTC76vXRVUf6hCJrm77cRi6M5ic+obfQnZ3o 8DDhvl8yY5b+xcEBWgNCfGxDNCbQMysaoayldIqhZSYcdOrv2tqEI0ZS8GCahHlk4ysS Lxpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W6aYYATu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v32si418349plb.146.2019.04.18.11.20.54; Thu, 18 Apr 2019 11:21:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W6aYYATu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404290AbfDRSSE (ORCPT + 99 others); Thu, 18 Apr 2019 14:18:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:42798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404189AbfDRSKw (ORCPT ); Thu, 18 Apr 2019 14:10:52 -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 E55FE218D3; Thu, 18 Apr 2019 18:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611051; bh=Z3RKATeyvQXF6q1qjBrNIOPYSWaSOx/6o1/iTqLf31c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W6aYYATuAAV72gVIZ4cFi5xBN1An9lIVz4shIYUdPF2XcdrPStOQ6EEY4UgNLOVN7 7Q1Y6O1Sg+YN3q9GbS8XVAUJOQb/VE97S7FjVqdaT7mJgSytLsYg40fZTmqr0++pAn /MHh0RIGs9twWE4vHU4wzAnjt8OMe0LSxv/x+Uvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changbin Du , Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Krister Johansen , Namhyung Kim , Peter Zijlstra , "Steven Rostedt (VMware)" , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.0 41/93] perf hist: Add missing map__put() in error case Date: Thu, 18 Apr 2019 19:57:19 +0200 Message-Id: <20190418160441.597435475@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit cb6186aeffda4d27e56066c79e9579e7831541d3 ] We need to map__put() before returning from failure of sample__resolve_callchain(). Detected with gcc's ASan. Signed-off-by: Changbin Du Reviewed-by: Jiri Olsa Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Krister Johansen Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Steven Rostedt (VMware) Fixes: 9c68ae98c6f7 ("perf callchain: Reference count maps") Link: http://lkml.kernel.org/r/20190316080556.3075-10-changbin.du@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/hist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 8aad8330e392..e416e76f5600 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1048,8 +1048,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent, iter->evsel, al, max_stack_depth); - if (err) + if (err) { + map__put(alm); return err; + } err = iter->ops->prepare_entry(iter, al); if (err) -- 2.19.1