aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/ktest/examples/include/ssh:/git@git.zx2c4.com
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2026-05-25 12:51:20 -0400
committerPaolo Abeni <pabeni@redhat.com>2026-05-28 13:35:31 +0200
commit5da98f55b13173c08f003011b76531b25c821c07 (patch)
tree2a4967fb561bafae936e540797e967309b8d7f8d /tools/testing/ktest/examples/include/ssh:/git@git.zx2c4.com
parentnet/handshake: hand off the pinned file reference to accept_doit (diff)
net/handshake: Close the submit-side sock_hold race
handshake_req_submit() publishes the request via handshake_req_hash_add() and __add_pending_locked(), drops hn_lock, and calls handshake_genl_notify() (which can sleep) before taking sock_hold() on req->hr_sk. A fast tlshd ACCEPT followed by DONE can drive handshake_complete()'s sock_put() into the window between the spin_unlock and the late sock_hold(); on a system where the consumer's fd held the only sk reference, the late sock_hold() then operates on an sk whose refcount has reached zero. The preceding two patches install an explicit file reference on struct handshake_req. That file pins sock->file, which pins the embedded struct socket, which defers inet_release()'s sock_put(). As long as hr_file is held, sk cannot reach refcount zero from the consumer side, and the submit-side sock_hold() with its matching sock_put() calls in handshake_complete() and handshake_req_cancel() is now redundant. Drop all three. The file reference already keeps each request's socket alive, and the lifetime story is contained in a single get_file()/fput() pair. Fixes: 3b3009ea8abb ("net/handshake: Create a NETLINK service for handling handshake requests") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Hannes Reinecke <hare@kernel.org> Link: https://patch.msgid.link/20260525-handshake-file-pin-v3-6-66c616906ead@oracle.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools/testing/ktest/examples/include/ssh:/git@git.zx2c4.com')
0 files changed, 0 insertions, 0 deletions