smb_vc_put() requires that the passed vcp be locked, so lock it before

dropping the connection when the requested service isn't available, or
we may try to release a lock that isn't locked.

This prevents an assertion failure when trying to mount a non-present
share using smbfs with INVARIANTS; a lock order reversal warning that
immediately follows is not yet fixed.

Reported by:	attilio
MFC after:	3 days
This commit is contained in:
Robert Watson 2008-11-02 20:22:24 +00:00
parent 6966d7767a
commit 6aaab44423

View File

@ -218,8 +218,10 @@ smb_sm_lookup(struct smb_vcspec *vcspec, struct smb_sharespec *shspec,
smb_sm_unlockvclist(td);
if (error == 0)
*vcpp = vcp;
else if (vcp)
else if (vcp) {
smb_vc_lock(vcp, LK_EXCLUSIVE, scred->scr_td);
smb_vc_put(vcp, scred);
}
return error;
}