Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp883322yba; Thu, 18 Apr 2019 11:09:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqz40EoALajXv1aJVA33gWAAy2rvReAF/MKgCcJ5SYiYrNDgsRPqfIdq2qsHv3t5hOJmTgWU X-Received: by 2002:a63:484f:: with SMTP id x15mr7090802pgk.428.1555610974460; Thu, 18 Apr 2019 11:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555610974; cv=none; d=google.com; s=arc-20160816; b=K704R+pAzWcTpGHGXn0NxnyYgtFF9/OOn7Ca/3XelY+O3DY8qGMMEZ8ytFwd/uEnnk WksrL47UFi+uVQ2olT4UKk250znj5zfRHE74uKg33z7guxWviH2bWzjYY6YIT2oEO/Mv U/vuUrK9yLc8HulTN3ULiINhKVw7yLI7UGOvuCRQrEPXh4dHCCkqFSEmwcGOln4wrxiU ztnYK1yVC24dzaJxExIfO+V3+0eVkx+w+MktFvHPB38vrS44Oxo6nv5f2PIht8qABg4T nV1wFSGlN4peeP4skdjmgNr0c9h8M4srwVZQ0wmiuguTs6zX3x77vdKGUndqi+4eWHFQ MGaw== 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=4v7CMof/5XcGFgKd9NePe/JP1vjzBuifjdkYQ3WpQGE=; b=NI99P06BQGlm9gO401mLfJZ3EbXo2ghoGy37sB5NUqd6OlHbICMOSkKX4LvVlzX/zK W4Zi0nRcwZOYfhC+An/qQ+CmbAPzFIKmhYp4k/F7Ybx7oW7XYryzCJz0o3eSG+TzUOjX GGnArWVk8q6v4i4XLrHu3eBop8M49GBhTO8Zrzy5BpXrEYlXFUSPg6F8W3qo1vY1Hco4 7J55r6GWDFipzvuzXVnM1YP8MAe/BJiw2Maf29DpDvb7uuNIgvo3l7LtghwaMBbQtiNE BCLQUnqg5IcoOFwOSHFEZl4ilwCChCzUpN/HhQaG4w26pi+66PCU3h4XuSrdBnKPDFr1 cE+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CpV6EN2E; 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 c144si3130753pfc.5.2019.04.18.11.09.19; Thu, 18 Apr 2019 11:09:34 -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=CpV6EN2E; 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 S2391647AbfDRSHi (ORCPT + 99 others); Thu, 18 Apr 2019 14:07:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:38388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391638AbfDRSHf (ORCPT ); Thu, 18 Apr 2019 14:07:35 -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 10C2921872; Thu, 18 Apr 2019 18:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610854; bh=fuUeL3w551QrNdVsjT5hP7ohUo9+0KYwy4wzAVMXvec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CpV6EN2EpuPBcgpSi0VJ6+V2Z+EzRi4V0DjecuijRckvC9ynYl/gLJRKKiN5C3kBN 8dx6YSBBvIkb8XcfRBHAgxFgVPRx8G2ei+o8z8dBX3TaghvG+skr5WG8XGExYdSMxt vLlJJFu7NYruCDsvLFkhLfBs8vKT48ipkfMgGDb8= 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 4.9 17/50] perf hist: Add missing map__put() in error case Date: Thu, 18 Apr 2019 19:57:28 +0200 Message-Id: <20190418160424.808095653@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@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 ad613ea51434..82833ceba339 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1027,8 +1027,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