Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jan 2025 06:08:17 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 488660360a71 - main - krpc/svc_vc: keep the vnet context during calls into rpctls
Message-ID:  <202501180608.50I68Hk6071478@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=488660360a71f65a31d3709559554c1a90f7220e

commit 488660360a71f65a31d3709559554c1a90f7220e
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-18 06:01:46 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-18 06:07:45 +0000

    krpc/svc_vc: keep the vnet context during calls into rpctls
---
 sys/rpc/svc_vc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c
index 9fc4108a5149..f70aabc5425d 100644
--- a/sys/rpc/svc_vc.c
+++ b/sys/rpc/svc_vc.c
@@ -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
@@ -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
@@ -853,13 +853,13 @@ tryagain:
 		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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501180608.50I68Hk6071478>