6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zilin Guan zilin@seu.edu.cn
[ Upstream commit 3072f00bba764082fa41b3c3a2a7b013335353d2 ]
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: 2fd5532044a89 ("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 --- net/handshake/tlshd.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/net/handshake/tlshd.c b/net/handshake/tlshd.c index d6f52839827ea..822507b87447c 100644 --- a/net/handshake/tlshd.c +++ b/net/handshake/tlshd.c @@ -253,6 +253,7 @@ static int tls_handshake_accept(struct handshake_req *req,
out_cancel: genlmsg_cancel(msg, hdr); + nlmsg_free(msg); out: return ret; }