linux/net/handshake
Zilin Guan 9d9bafbf99 net/handshake: Fix memory leak in tls_handshake_accept()
[ Upstream commit 3072f00bba ]

In tls_handshake_accept(), a netlink message is allocated using
genlmsg_new(). In the error handling path, genlmsg_cancel() is called
to cancel the message construction, but the message itself is not freed.
This leads to a memory leak.

Fix this by calling nlmsg_free() in the error path after genlmsg_cancel()
to release the allocated memory.

Fixes: 2fd5532044 ("net/handshake: Add a kernel API for requesting a TLSv1.3 handshake")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Link: https://patch.msgid.link/20251106144511.3859535-1-zilin@seu.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-11-24 10:35:50 +01:00
..
.kunitconfig net/handshake: Add Kunit tests for the handshake consumer API 2023-04-19 18:48:48 -07:00
alert.c net/handshake: Trace events for TLS Alert helpers 2023-07-28 14:07:59 -07:00
genl.c handshake: Fix sign of socket file descriptor fields 2023-10-02 12:34:21 -07:00
genl.h net: ynl: prefix uAPI header include with uapi/ 2023-05-26 10:30:14 +01:00
handshake-test.c net/handshake: Fix handshake_req_destroy_test1 2024-02-08 18:32:29 -08:00
handshake.h net/handshake: Add API for sending TLS Closure alerts 2023-07-28 14:07:59 -07:00
Makefile net/handshake: Add API for sending TLS Closure alerts 2023-07-28 14:07:59 -07:00
netlink.c net/handshake: use sockfd_put() helper 2024-08-27 16:09:25 -07:00
request.c net/handshake: remove fput() that causes use-after-free 2023-06-14 22:26:37 -07:00
tlshd.c net/handshake: Fix memory leak in tls_handshake_accept() 2025-11-24 10:35:50 +01:00
trace.c net/handshake: Trace events for TLS Alert helpers 2023-07-28 14:07:59 -07:00