From b4e07e3da5a22bdd3aa4e44ff4f25083c2438ca8 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 15 Sep 2020 23:03:56 +0000 Subject: [PATCH] Fix locking in uipc_accept(). Reported by: cy MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/uipc_usrreq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index e22de655382..5818c9fb851 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -506,7 +506,10 @@ uipc_accept(struct socket *so, struct sockaddr **nam) else sa = &sun_noname; bcopy(sa, *nam, sa->sa_len); - unp_pcb_unlock_pair(unp, unp2); + if (unp2 != NULL) + unp_pcb_unlock_pair(unp, unp2); + else + UNP_PCB_UNLOCK(unp); return (0); }