]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: assertion failure
authorVMware, Inc <>
Thu, 17 Jun 2010 21:10:57 +0000 (14:10 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:10:57 +0000 (14:10 -0700)
The new hook function implanting function caught a panic when it
was invocated a second time. Make the function tolerate multiple
invocations, only panicing if the later invocations attempt to
plant hook functions different than the first time.

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

index 2e766479b03428f3a463c72dffaa8ab6ce3236c0..eb8606b9890f3e6f0ddd010b20ddc09344d4af00 100644 (file)
@@ -564,11 +564,21 @@ void
 MXUserInstallMxHooks(void (*theMxLockLister)(void),   // IN: MX list function
                      MX_Rank (*theMxRankFunc)(void))  // IN: MX rank function
 {
-   /* Only allow registration once */
-   ASSERT((MXUserMxLockLister == NULL) && (MXUserMxCheckRank == NULL));
+   /*
+    * This function can be called more than once but the second and later
+    * invocations must be attempting to install the same hook functions as
+    * the first invocation.
+    */
 
-   MXUserMxLockLister = theMxLockLister;
-   MXUserMxCheckRank = theMxRankFunc;
+   if ((MXUserMxLockLister == NULL) &&
+       (MXUserMxCheckRank == NULL)) {
+      MXUserMxLockLister = theMxLockLister;
+      MXUserMxCheckRank = theMxRankFunc;
+   } else {
+      ASSERT((MXUserMxLockLister == theMxLockLister) &&
+             (MXUserMxCheckRank == theMxRankFunc)
+            );
+   }
 }