The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=712079d3810617ba7a28e959f5536b1ee06e30e1
commit 712079d3810617ba7a28e959f5536b1ee06e30e1 Author: Mark Johnston <[email protected]> AuthorDate: 2023-06-21 18:20:16 +0000 Commit: Mark Johnston <[email protected]> CommitDate: 2023-06-21 18:38:26 +0000 unix: Fix uipc_peeraddr() to handle self-connected sockets Reported by: [email protected] Reported by: [email protected] Fixes: e8f6e5b2d969 ("unix: Fix locking in uipc_peeraddr()") MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/uipc_usrreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index bd7a2cca245f..100891cfef68 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -890,16 +890,16 @@ uipc_peeraddr(struct socket *so, struct sockaddr **nam) unp2 = unp_pcb_lock_peer(unp); if (unp2 != NULL) { if (unp2->unp_addr != NULL) - sa = (struct sockaddr *) unp2->unp_addr; + sa = (struct sockaddr *)unp2->unp_addr; else sa = &sun_noname; bcopy(sa, *nam, sa->sa_len); - UNP_PCB_UNLOCK(unp2); + unp_pcb_unlock_pair(unp, unp2); } else { sa = &sun_noname; bcopy(sa, *nam, sa->sa_len); + UNP_PCB_UNLOCK(unp); } - UNP_PCB_UNLOCK(unp); return (0); }
