Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jan 2022 12:58:28 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ac82aa1bf742 - stable/12 - libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper
Message-ID:  <202201151258.20FCwSJ0094380@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kib:

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

commit ac82aa1bf742def55998d27e98496b46c18cfcd5
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-01-09 05:09:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-01-15 12:57:40 +0000

    libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from portmapper
    
    PR:     261051
    
    (cherry picked from commit 6d06bc688eb5a9f9e389b69c388d591a40edc422)
---
 lib/libc/rpc/rpc_soc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
index 1e5cd86d7ed4..ae23442e9a16 100644
--- a/lib/libc/rpc/rpc_soc.c
+++ b/lib/libc/rpc/rpc_soc.c
@@ -120,11 +120,11 @@ clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, int *
 		proto = strcmp(tp, "udp") == 0 ? IPPROTO_UDP : IPPROTO_TCP;
 		sport = pmap_getport(raddr, (u_long)prog, (u_long)vers,
 		    proto);
+		mutex_lock(&rpcsoc_lock);	/* pmap_getport is recursive */
 		if (sport == 0) {
 			goto err;
 		}
 		raddr->sin_port = htons(sport);
-		mutex_lock(&rpcsoc_lock);	/* pmap_getport is recursive */
 	}
 
 	/* Transform sockaddr_in to netbuf */



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