From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06DDA4A2E14 for ; Sat, 28 Feb 2026 17:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300885; cv=none; b=IBCUkCBy/hHxhZ704DnkidPUkFC4DzyJOxdbo8vNPdHqwGP1J+73UlH18uFFF4G+zurzhzeMaXT65JIFSJoQwK1SwCqZBMz9aqQo9mnoHJdfIV7InhzXXTNzHCiqjZJ9OCG93rlcY/Z+ndoCd93v6rIO6AosnpAXlEdwmH6Brtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300885; c=relaxed/simple; bh=Ym5E9m8p7OyhZ3KnhCyR7rKpXnU+/ukuJfASpTDuh1U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VwrkcSPo8AtDc4WL6uiP41pCGbuHGd2MmaeJCnLQFMBH0qR+5WaBbNdgV5Pg7SJMAEAnyaqlVL9FSdclJmF747U1A1sIwSa2lMbwqJQ9EQ7U++lY6UlRGZ7NafSvqa0aIAbh7xXN1RzlODSEhHIRmwWobO9JDk4slgx2/ZZaVVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eYr2Mh1w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eYr2Mh1w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9966C116D0; Sat, 28 Feb 2026 17:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300884; bh=Ym5E9m8p7OyhZ3KnhCyR7rKpXnU+/ukuJfASpTDuh1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYr2Mh1wMa66CP+q6yn/WEIyQj5o2oe+sj8YIcHfRMb4chZjHPgJJTeHd9TG7PtuX OVKf2mWMm0uir49TBUnfA86p9e9R/7JQXYoqcK65RbB9Tt73x1g6yHaFYp8+J6RyAr tNZdxmH3VbhVzRuYIiLU408Zl/7J8NUtMvCdLRo9mN298aNtZu6ak5ueGtxxjHHwZD 2WgU42JL8sWXKVBW49l+lI40fD4haRjk8OpSB7BlV2JJxGwB9h8anDUSEl0ac6qIfx Fw+zoXfaRQnywzdG8Bk/QVm8WN1nJLmgR48y+nZcA59VMxh8uJLESs2G1FgaPqTqgL nEPsvLAQRwXDQ== From: Sasha Levin To: patches@lists.linux.dev Cc: Ian Rogers , Aditya Bodkhe , Adrian Hunter , Albert Ou , Alexandre Ghiti , Andi Kleen , Athira Rajeev , Chun-Tse Shao , Dmitriy Vyukov , "Dr. David Alan Gilbert" , Guo Ren , Haibo Xu , Howard Chu , Ingo Molnar , James Clark , Jiri Olsa , John Garry , =?UTF-8?q?Krzysztof=20=C5=81opatowski?= , Leo Yan , Mark Wielaard , Namhyung Kim , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Sergei Trofimovich , Shimin Guo , Stephen Brennan , Thomas Falcon , Will Deacon , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.18 008/752] perf symbol-elf: Fix leak of ELF files with GNU debugdata Date: Sat, 28 Feb 2026 12:35:19 -0500 Message-ID: <20260228174750.1542406-8-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228174750.1542406-1-sashal@kernel.org> References: <20260228174750.1542406-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ian Rogers [ Upstream commit 92d65d9c31621befe0a5f7c0bd43bd217613c6b6 ] The processing of DSO_BINARY_TYPE__GNU_DEBUGDATA in symsrc__init happens with an open ELF file but the error path only closes the associate fd. Fix the goto so that the ELF file is also ended and memory released. Fixes: b10f74308e130527 ("perf symbol: Support .gnu_debugdata for symbols") Signed-off-by: Ian Rogers Cc: Aditya Bodkhe Cc: Adrian Hunter Cc: Albert Ou Cc: Alexandre Ghiti Cc: Andi Kleen Cc: Athira Rajeev Cc: Chun-Tse Shao Cc: Dmitriy Vyukov Cc: Dr. David Alan Gilbert Cc: Guo Ren Cc: Haibo Xu Cc: Howard Chu Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: John Garry Cc: Krzysztof Ɓopatowski Cc: Leo Yan Cc: Mark Wielaard Cc: Namhyung Kim Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: Peter Zijlstra Cc: Sergei Trofimovich Cc: Shimin Guo Cc: Stephen Brennan Cc: Thomas Falcon Cc: Will Deacon Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/symbol-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 9e820599bab38..9d62386464680 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1170,7 +1170,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, Elf *embedded = read_gnu_debugdata(dso, elf, name, &new_fd); if (!embedded) - goto out_close; + goto out_elf_end; elf_end(elf); close(fd); -- 2.51.0