aboutsummaryrefslogtreecommitdiff
path: root/sys/rpc
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2025-06-21 23:49:13 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2025-06-21 23:49:13 +0000
commit26ee0593920946646882a14997d15e16b1bec772 (patch)
treea4ee00ebc0713b87fd304545d7bd8516fbb41804 /sys/rpc
parent3a8960711f4319f9b894ea2453c89065ee1b3a10 (diff)
Diffstat (limited to 'sys/rpc')
-rw-r--r--sys/rpc/rpcsec_tls/rpctls_impl.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/rpc/rpcsec_tls/rpctls_impl.c b/sys/rpc/rpcsec_tls/rpctls_impl.c
index 6745a04e8ac8..93fe283e65fd 100644
--- a/sys/rpc/rpcsec_tls/rpctls_impl.c
+++ b/sys/rpc/rpcsec_tls/rpctls_impl.c
@@ -181,6 +181,12 @@ sys_rpctls_syscall(struct thread *td, struct rpctls_syscall_args *uap)
return (EPERM);
}
if ((error = falloc(td, &fp, &fd, 0)) != 0) {
+ /*
+ * The socket will not be acquired by the daemon,
+ * but has been removed from the upcall socket RB.
+ * As such, it needs to be closed here.
+ */
+ soclose(ups.so);
KRPC_CURVNET_RESTORE();
return (error);
}
@@ -223,13 +229,11 @@ rpctls_rpc_failed(struct upsock *ups, struct socket *so)
mtx_unlock(&rpctls_lock);
MPASS(removed == ups);
/*
- * Do a shutdown on the socket, since the daemon is
- * probably stuck in SSL_accept() trying to read the
- * socket. Do not soclose() the socket, since the
- * daemon will close() the socket after SSL_accept()
- * returns an error.
+ * Since the socket was still in the RB tree when
+ * this function was called, the daemon will not
+ * close it. As such, it needs to be closed here.
*/
- soshutdown(so, SHUT_RD);
+ soclose(so);
} else {
/*
* The daemon has taken the socket from the tree, but