diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-07-18 01:29:43 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-07-18 01:29:43 +0000 |
commit | 06c2659597c719401f59e59b28617e72b5d59971 (patch) | |
tree | 409ec598a4cbb5b30085d3442f175af954a185bb /sys/kern | |
parent | 6670049bcf2bfe0a20b1bb71db124ca371ebeea7 (diff) | |
download | FreeBSD-src-06c2659597c719401f59e59b28617e72b5d59971.zip FreeBSD-src-06c2659597c719401f59e59b28617e72b5d59971.tar.gz |
Drop Giant and acquire the UNIX domain socket subsystem lock a bit
earlier in unp_connect() so that vp->v_socket can't change between
our copying its value to a local variable and later use of that
variable. This may have been responsible for a panic during
shutdown that I experienced where simultaneous closing of a listen
socket by rpcbind and a new connection being made to rpcbind by
mountd.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_usrreq.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 7474012..1a87d14 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -794,17 +794,17 @@ unp_connect(so, nam, td) error = VOP_ACCESS(vp, VWRITE, td->td_ucred, td); if (error) goto bad; + mtx_unlock(&Giant); + UNP_LOCK(); so2 = vp->v_socket; if (so2 == NULL) { error = ECONNREFUSED; - goto bad; + goto bad2; } if (so->so_type != so2->so_type) { error = EPROTOTYPE; - goto bad; + goto bad2; } - mtx_unlock(&Giant); - UNP_LOCK(); if (so->so_proto->pr_flags & PR_CONNREQUIRED) { if (so2->so_options & SO_ACCEPTCONN) { /* |