Skip to content

Commit 3072f00

Browse files
GoodLuck612kuba-moo
authored andcommitted
net/handshake: Fix memory leak in tls_handshake_accept()
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: 2fd5532 ("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>
1 parent ec33f2e commit 3072f00

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

net/handshake/tlshd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ static int tls_handshake_accept(struct handshake_req *req,
259259

260260
out_cancel:
261261
genlmsg_cancel(msg, hdr);
262+
nlmsg_free(msg);
262263
out:
263264
return ret;
264265
}

0 commit comments

Comments
 (0)