]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: RW lock assertion failure
authorVMware, Inc <>
Thu, 17 Jun 2010 21:26:17 +0000 (14:26 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:26:17 +0000 (14:26 -0700)
The MXUser RW lock release code has a bug in it... it asserts on
an unexpected reference count. The bug was caused by not decrementing
the reference count before the assertion.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ulRW.c

index 5d7ab81cfd18e160193dde2b6039b63a6c0566b8..c4d83ae166e240e5844a60bef32e27cddc8ed3c3 100644 (file)
@@ -822,6 +822,8 @@ MXUser_ReleaseRWLock(MXUserRWLock *lock)  // IN/OUT:
 
    MXUserReleaseTracking(&lock->header);
 
+   Atomic_Dec(&lock->holderCount);
+
    if (LIKELY(lock->useNative)) {
       int err = MXUserNativeRWRelease(&lock->nativeLock, myContext->state);
 
@@ -835,7 +837,6 @@ MXUser_ReleaseRWLock(MXUserRWLock *lock)  // IN/OUT:
    }
 
    myContext->state = RW_UNLOCKED;
-   Atomic_Dec(&lock->holderCount);
 }
 
 /*