]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/handshake: restore destructor on submit failure
authorcaoping <caoping@cmss.chinamobile.com>
Thu, 4 Dec 2025 09:10:58 +0000 (01:10 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:24 +0000 (10:14 +0100)
commit7b82a1d6ae869533d8bdb0282a3a78faed8e63dd
treed8ee254dd3ff08376f79fc50b99c5798ebb3827d
parent82f7416bcbd951549e758d15fc1a96a5afc2e900
net/handshake: restore destructor on submit failure

commit 6af2a01d65f89e73c1cbb9267f8880d83a88cee4 upstream.

handshake_req_submit() replaces sk->sk_destruct but never restores it when
submission fails before the request is hashed. handshake_sk_destruct() then
returns early and the original destructor never runs, leaking the socket.
Restore sk_destruct on the error path.

Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests")
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: caoping <caoping@cmss.chinamobile.com>
Link: https://patch.msgid.link/20251204091058.1545151-1-caoping@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/handshake/request.c