Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3712463pxv; Mon, 26 Jul 2021 10:01:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM2mx9c2RJYjXa4hTd9+LtUuH0hXoyW3aT9/25wgNBzDvIjjODqN1yJqzgibBIG4hnQ+IB X-Received: by 2002:a17:906:8443:: with SMTP id e3mr4691930ejy.46.1627318903020; Mon, 26 Jul 2021 10:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627318903; cv=none; d=google.com; s=arc-20160816; b=BRWu+WXAAZVkE3na3HlM4RFKwayE81C8i/bVYvpKB8g2N4W0hj5V9VIQoeDBsDp1// eYm/US/7ycMhZM9qm/etxB7t4iDyHuQNKYPa3DB4NX0GO8MCBIUrkR2KfTYIRrycC/cX wvK5plRWUbopFfZxBGGnRmHK/K35rbC9WzHqlOQHKDdiQiNLmXfOfeRORcQQ0xtT3gPm K6rYZ69ZEd9w29DLA2brB2I7cJMe2uNwL108ScJyoEbbArmtyYZsl4fSq+883Pc1mN/2 m4OAy4WBXFJUkmNor4KbsZBOgfMQ4p0rzOcFGckCoQuo3vqJPubA3wv9cbTUz5ZvVLtm FZtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hQ1KvIldwJ/h6M6EwSJSjAhurKBR7GCgvHM+c1ZGTGo=; b=CFIZJqP6RsBo5TirX7/b6Q9cwxOZafsvCFzCesOOsue0gAYh47GrlO7KSsG5SCvhkJ P8TFbS3GQUhvsubsNEaQfQpB4o8EWjPukscUZQJ5ekIcsZixxfcMkmu6LaTQh+lUU2UW EGTh/fqsz44YemaNDN5MIeBbTF3xDR3WYnjglJwVnN3RnKof6Jio2W9+uhnkw0gBFQpS 492nmGSJrcnkEJOZKvBdE4BQOj6sKcGzM7Alc6G2v9I4SQbqRE/mUEDnegsBa4HBT3CR UsmLc9XA6LdHYSu+r6WUPaj7FaoJXZePj1/a7r0YY/YU1FRUTxCC82L2O66LOT+ONHMZ MnqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F4L535jz; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si472447ejd.239.2021.07.26.10.01.15; Mon, 26 Jul 2021 10:01:43 -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=@linuxfoundation.org header.s=korg header.b=F4L535jz; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234533AbhGZPg4 (ORCPT + 99 others); Mon, 26 Jul 2021 11:36:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:35274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237139AbhGZPVO (ORCPT ); Mon, 26 Jul 2021 11:21:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EA8060F5A; Mon, 26 Jul 2021 16:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315302; bh=jnwL9oSy03Knv9wzFjNz98XWr/TQv4RU3bqPVP0kbDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4L535jzI+TymcVxFe/kgf9689Pz2/SReOfOYH9c6QXQIyU7PD7pcIO6tTVXrgd0X s9lEhGNBDFsc6MLwPOAEfkb1f2RvafKOv37pibPa552LTBxGzH8xSzYbN6mWDagXQu whSuc2EObDn+07GEq0Be/f6aivMuGMWS0D0FER80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Riccardo Mancini , Ian Rogers , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.10 044/167] perf lzma: Close lzma stream on exit Date: Mon, 26 Jul 2021 17:37:57 +0200 Message-Id: <20210726153840.870236735@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153839.371771838@linuxfoundation.org> References: <20210726153839.371771838@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Riccardo Mancini [ Upstream commit f8cbb0f926ae1e1fb5f9e51614e5437560ed4039 ] ASan reports memory leaks when running: # perf test "88: Check open filename arg using perf trace + vfs_getname" One of these is caused by the lzma stream never being closed inside lzma_decompress_to_file(). This patch adds the missing lzma_end(). Signed-off-by: Riccardo Mancini Fixes: 80a32e5b498a7547 ("perf tools: Add lzma decompression support for kernel module") Cc: Ian Rogers Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/aaf50bdce7afe996cfc06e1bbb36e4a2a9b9db93.1626343282.git.rickyman7@gmail.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/lzma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c index 39062df02629..51424cdc3b68 100644 --- a/tools/perf/util/lzma.c +++ b/tools/perf/util/lzma.c @@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) if (ferror(infile)) { pr_err("lzma: read error: %s\n", strerror(errno)); - goto err_fclose; + goto err_lzma_end; } if (feof(infile)) @@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) if (writen(output_fd, buf_out, write_size) != write_size) { pr_err("lzma: write error: %s\n", strerror(errno)); - goto err_fclose; + goto err_lzma_end; } strm.next_out = buf_out; @@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd) break; pr_err("lzma: failed %s\n", lzma_strerror(ret)); - goto err_fclose; + goto err_lzma_end; } } err = 0; +err_lzma_end: + lzma_end(&strm); err_fclose: fclose(infile); return err; -- 2.30.2