Skip to content

Commit 6af2a01

Browse files
caopingkuba-moo
authored andcommitted
net/handshake: restore destructor on submit failure
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: 3b3009e ("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>
1 parent 9e7477a commit 6af2a01

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/handshake/request.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ int handshake_req_submit(struct socket *sock, struct handshake_req *req,
276276
out_unlock:
277277
spin_unlock(&hn->hn_lock);
278278
out_err:
279+
/* Restore original destructor so socket teardown still runs on failure */
280+
req->hr_sk->sk_destruct = req->hr_odestruct;
279281
trace_handshake_submit_err(net, req, req->hr_sk, ret);
280282
handshake_req_destroy(req);
281283
return ret;

0 commit comments

Comments
 (0)