From: VMware, Inc <> Date: Thu, 17 Jun 2010 21:10:57 +0000 (-0700) Subject: lib/lock: assertion failure X-Git-Tag: 2010.06.16-268169~161 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7eed5107237a83cdbc30cb1f7fbec2f2060970f7;p=thirdparty%2Fopen-vm-tools.git lib/lock: assertion failure 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 --- diff --git a/open-vm-tools/lib/lock/ul.c b/open-vm-tools/lib/lock/ul.c index 2e766479b..eb8606b98 100644 --- a/open-vm-tools/lib/lock/ul.c +++ b/open-vm-tools/lib/lock/ul.c @@ -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) + ); + } }