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.
This commit is contained in:
Robert Watson 2004-07-18 01:29:43 +00:00
parent 96c370ccf5
commit 2260c03d77
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132325

View File

@ -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) {
/*