From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384805; b=vRxoOBoMJ++2zd1d7CX4BNLqf7wpreGpfOowZZk5arRZHRIo+gXQ37ZmnudpI1gwaQLw M2tC+hB6yyVTqLX4/0Ok6UDQyLrGEq2eDdeJFMY03fp3S2/nkYo86E3KtGO4KkgrOLVLO UXK9dVX1GGsVvUQbcxlciBMbBpAggF87qqC4wr+20/yxCr8eiMOphvjw5CTydcUJdSEEc oofWQsQXcm5JpySUJN/drBTe7ozBDX3mlFxcrBFXsLofcQ0ZwYiuhchM9a0/IdhMoVBo9 ZCQvE+g+RNHyqqvFOpokpf5mVesvO4YccBoUzMWyxeM929DCbn5Q8Zz36/dejhDA/rw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384805; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=BU2KG9M1WCKnhX8h8cY0yjlC2F2yPLXQz4ldDr0xADo=; b=U6jMUcvSwkf5NJ8P1CdaIm6ud/oZgucWHQj+Z9Ga6G4ShncDaNnrFLs46Gpm256aT1PU PfYYYbzuvlpCqa++586bpSv8KlzLi7m9p9yh6sOftkAk5gVMP3mX9BYyASkq1bzS7QbQX VpaMfVGNB3H9/sV4NrLJw3el3EwzO4Sj5S83rJqffUlJWlrIvNjkpaIeLZuhkwmVMRxXS 0BFiP9RgGg1lNJA3tGsib0nu5m7CQgGjKnTbykSml2G0Ue+kQOOjThuuZnsgdTYz6ousQ sns4XGSzl7JBJ2dzTdcCs3b1D5odT3kA2pYmB2pycq+MmovD14DtmErywNZrFAU904g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PmkU1cE3; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84837606A322; Fri, 4 Dec 2026 11:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=PmkU1cE3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC4FB1F000C2; Fri, 4 Dec 2026 11:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384805; bh=BU2KG9M1WCKnhX8h8cY0yjlC2F2yPLXQz4ldDr0xADo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=PmkU1cE3KTkDuAhEbJmo6ZRzriA4eedpHTsVsY3caZ+vz4yPeoGh12OK1hHWZIX2r bkqEKs1ZqgJbgC/oaJ+YlZtwO21J+t+UhK3/pazX5QNYyyqqgJD4f95RZRBJscptDm oUMsC94CD6cz/OlZ0dKq6ficGX13UtjP9ORHCHEw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot , Ian Rogers , Stephane Eranian , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.6 0301/1167] perf jitdump: Free event in jit_repipe_code_move() Date: Fri, 4 Dec 2026 18:55:28 +0900 Message-ID: <20261204100709.868081109@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnaldo Carvalho de Melo [ Upstream commit 7fc5851aac606b9e4143f6857710cc5f346770c5 ] jit_repipe_code_move() allocates a perf_event with calloc but never frees it — the 'out' label exits with only perf_sample__exit(). The sibling function jit_repipe_code_load() correctly calls free(event) at its out label. Add the same free(event) to jit_repipe_code_move(). Fixes: 9b07e27f88b9 ("perf inject: Add jitdump mmap injection support") Reported-by: sashiko-bot Reviewed-by: Ian Rogers Cc: Stephane Eranian Assisted-by: LLM Signed-off-by: Arnaldo Carvalho de Melo [ sashal: Added an out: label with free(event); and changed the early return ret; after the mmap2 failure to goto out;, since this tree's function has no out: label or perf_sample__exit(). ] Signed-off-by: Sasha Levin --- tools/perf/util/jitdump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 58ba7d6806c4b..10505db63e386 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -672,12 +672,14 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr) ret = perf_event__process_mmap2(tool, event, &sample, jd->machine); if (ret) - return ret; + goto out; ret = jit_inject_event(jd, event); if (!ret) build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine); +out: + free(event); return ret; } -- 2.53.0