git: 712079d38106 - main - unix: Fix uipc_peeraddr() to handle self-connected sockets
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 Jun 2023 18:41:04 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=712079d3810617ba7a28e959f5536b1ee06e30e1 commit 712079d3810617ba7a28e959f5536b1ee06e30e1 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-06-21 18:20:16 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-06-21 18:38:26 +0000 unix: Fix uipc_peeraddr() to handle self-connected sockets Reported by: syzbot+c2da2dbae5fe006556bc@syzkaller.appspotmail.com Reported by: syzbot+b4d6b093b1d78bfa859b@syzkaller.appspotmail.com 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); }