Page MenuHomeFreeBSD

clnt_rc.c: Fix the case where a TLS handshake fails
ClosedPublic

Authored by rmacklem on Jun 28 2025, 8:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 23, 2:16 AM
Unknown Object (File)
Wed, Jul 22, 3:12 PM
Unknown Object (File)
Sat, Jul 18, 4:16 AM
Unknown Object (File)
Fri, Jul 17, 2:50 AM
Unknown Object (File)
Tue, Jun 30, 11:44 AM
Unknown Object (File)
Jun 27 2026, 9:33 AM
Unknown Object (File)
Jun 23 2026, 10:36 AM
Unknown Object (File)
Jun 22 2026, 6:10 PM
Subscribers

Details

Summary

When a TLS handshake fails during a NFS-over-TLS
mount attempt, the socket was left around because
it needed to be dereferenced. The dereference was
not happening in clnt_vc_destroy() because ct_closeit
was not set to TRUE.

This patch moves the code that sets ct_closeit to TRUE
up to before the rpctls_connect() call, so that ct_closeit
is set to TRUE if it fails and clnt_vc_destroy() will then
dereference the socket.

Test Plan

Tested by doing NS-over-TLS mount attempts when
rpc.tlsservd was not running on the server and then
observing the status of the socket via "netstat -a"
after the mount fails.

Without this patch, the socket is left around in
CLOSED state.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable