Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8A7D146C4D6; Tue, 21 Jul 2026 18:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658297; cv=none; b=XDffN174rUlOHNddK96Xy7xbdCCk0qDhHYBi6xP7681OsmfJuvKLu+51R2+3O1k9Waw9tR06+0BQp/CP1+gM5DbculmLVVcdPl8jyTGzecAsXynNxlEosBCX7NRDftKapCZBbBX7W5vzOPPWe9oIgWim3lzHWCdeIWoSBrZlWHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658297; c=relaxed/simple; bh=Nk+hcsX/80qhz3ylQYmbirbijxZPkOgNTlxwVQgA4JE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MC6WgDjPeZQBMB67PQtfoPXYdYYfiOzCPG/KIUElWgLWonNNmb+qlFArJKzuuCJgJHPVPhTvZUL4q/DqT+ulOC+ZTKpdlkQTKCL/ZZpTctiR6wFn+5xygV7cUh0EBzmWQWeirarOBNXX6K0S5jtUpmWjRlcoY43fMTVE0WVETpw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wG5PJDba; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wG5PJDba" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A18351F000E9; Tue, 21 Jul 2026 18:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658296; bh=5SuErNs1w5N7QoaQdBT1CMQ40LovnucC1ZuYVMI0oi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wG5PJDba371cYxEn5To1YF+qcD50L5r5RA0GY3A07t1A2ht/nzydrK0Hh1h5cGpQO +DRxmTOW9w+wd9UdSXUEdeDQ+EEyWnEQ2gnYKea2+8UsoWJ5gMNBhW1pOU6jFaj0lz fAGyzi8Va/NJUsSBPy5liVP2A6VkPyPrERj+UVag= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wang Yan , Paolo Abeni , Sasha Levin Subject: [PATCH 6.18 1090/1611] selftests/net: fix EVP_MD_CTX leak in tcp_mmap Date: Tue, 21 Jul 2026 17:20:06 +0200 Message-ID: <20260721152539.930590136@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wang Yan [ Upstream commit f4ef35efbb49527293309f668ea73ec5de9b8e7a ] In tcp_mmap.c, both child_thread() and main() allocate an EVP_MD_CTX via EVP_MD_CTX_new() when integrity checking is enabled, but neither function releases the context. child_thread() misses the free in its common cleanup block, and main() returns without freeing the context. This results in a SHA256 context leak on every run that uses the ‑i (integrity) option. Add the missing EVP_MD_CTX_free() calls to the appropriate cleanup paths to fix the leak. Fixes: 5c5945dc695c ("selftests/net: Add SHA256 computation over data sent in tcp_mmap") Signed-off-by: Wang Yan Link: https://patch.msgid.link/20260702025949.442523-1-wangyan01@kylinos.cn Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- tools/testing/selftests/net/tcp_mmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c index 4fcce5150850dd..2544ae35d07a83 100644 --- a/tools/testing/selftests/net/tcp_mmap.c +++ b/tools/testing/selftests/net/tcp_mmap.c @@ -313,6 +313,8 @@ void *child_thread(void *arg) tcp_info_get_rcv_mss(fd)); } error: + if (ctx) + EVP_MD_CTX_free(ctx); munmap(buffer, buffer_sz); close(fd); if (zflg) @@ -606,6 +608,8 @@ int main(int argc, char *argv[]) EVP_DigestFinal_ex(ctx, digest, &digest_len); send(fd, digest, (size_t)SHA256_DIGEST_LENGTH, 0); } + if (ctx) + EVP_MD_CTX_free(ctx); close(fd); munmap(buffer, buffer_sz); return 0; -- 2.53.0