svn commit: r194967 - in stable/7/sys: . contrib/pf kern
John Baldwin
jhb at FreeBSD.org
Thu Jun 25 16:10:06 UTC 2009
Author: jhb
Date: Thu Jun 25 16:10:04 2009
New Revision: 194967
URL: http://svn.freebsd.org/changeset/base/194967
Log:
MFC: Fix a deadlock in the getpeername() method for UNIX domain sockets.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/kern/uipc_usrreq.c
Modified: stable/7/sys/kern/uipc_usrreq.c
==============================================================================
--- stable/7/sys/kern/uipc_usrreq.c Thu Jun 25 15:47:32 2009 (r194966)
+++ stable/7/sys/kern/uipc_usrreq.c Thu Jun 25 16:10:04 2009 (r194967)
@@ -672,7 +672,7 @@ uipc_peeraddr(struct socket *so, struct
KASSERT(unp != NULL, ("uipc_peeraddr: unp == NULL"));
*nam = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK);
- UNP_PCB_LOCK(unp);
+ UNP_GLOBAL_RLOCK();
/*
* XXX: It seems that this test always fails even when connection is
* established. So, this else clause is added as workaround to
@@ -682,7 +682,7 @@ uipc_peeraddr(struct socket *so, struct
if (unp2 != NULL) {
UNP_PCB_LOCK(unp2);
if (unp2->unp_addr != NULL)
- sa = (struct sockaddr *) unp->unp_conn->unp_addr;
+ sa = (struct sockaddr *) unp2->unp_addr;
else
sa = &sun_noname;
bcopy(sa, *nam, sa->sa_len);
@@ -691,7 +691,7 @@ uipc_peeraddr(struct socket *so, struct
sa = &sun_noname;
bcopy(sa, *nam, sa->sa_len);
}
- UNP_PCB_UNLOCK(unp);
+ UNP_GLOBAL_RUNLOCK();
return (0);
}
More information about the svn-src-stable-7
mailing list