From 6aaab44423f5c3600c7cb3ffabb8ea6c64f05221 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sun, 2 Nov 2008 20:22:24 +0000 Subject: [PATCH] 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 --- sys/netsmb/smb_conn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netsmb/smb_conn.c b/sys/netsmb/smb_conn.c index 82f6382da1f8..3480181502d3 100644 --- a/sys/netsmb/smb_conn.c +++ b/sys/netsmb/smb_conn.c @@ -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; }