Skip to content

Commit

Permalink
krpc/svc_vc: keep the vnet context during calls into rpctls
Browse files Browse the repository at this point in the history
  • Loading branch information
glebius committed Jan 18, 2025
1 parent 6a876e9 commit 4886603
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/rpc/svc_vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ svc_vc_destroy_common(SVCXPRT *xprt)
if (xprt->xp_socket) {
if ((xprt->xp_tls & (RPCTLS_FLAGS_HANDSHAKE |
RPCTLS_FLAGS_HANDSHFAIL)) != 0) {
CURVNET_SET(xprt->xp_socket->so_vnet);
if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0) {
/*
* If the upcall fails, the socket has
Expand All @@ -505,7 +506,6 @@ svc_vc_destroy_common(SVCXPRT *xprt)
xprt->xp_sslproc, &reterr);
}
/* Must sorele() to get rid of reference. */
CURVNET_SET(xprt->xp_socket->so_vnet);
sorele(xprt->xp_socket);
CURVNET_RESTORE();
} else
Expand Down Expand Up @@ -853,13 +853,13 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg,
if ((xprt->xp_tls & RPCTLS_FLAGS_HANDSHAKE) != 0 &&
error == ENXIO) {
KRPC_VNET(svc_vc_tls_alerts)++;
KRPC_CURVNET_RESTORE();
/* Disable reception. */
xprt->xp_dontrcv = TRUE;
sx_xunlock(&xprt->xp_lock);
ret = rpctls_srv_handlerecord(xprt->xp_sslsec,
xprt->xp_sslusec, xprt->xp_sslrefno,
xprt->xp_sslproc, &reterr);
KRPC_CURVNET_RESTORE();
sx_xlock(&xprt->xp_lock);
xprt->xp_dontrcv = FALSE;
if (ret != RPC_SUCCESS || reterr != RPCTLSERR_OK) {
Expand Down

0 comments on commit 4886603

Please sign in to comment.