Windows: correct locking in cm_FreeServerList
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 18 Apr 2010 17:20:52 +0000 (18:20 +0100)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 18 Apr 2010 17:53:07 +0000 (10:53 -0700)
The cm_serverLock must be held when checking the state
of the list head.

LICENSE MIT

Change-Id: I1134a6617d4c1e38b95512b1fdc41c5f5857ea7a
Reviewed-on: http://gerrit.openafs.org/1774
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_server.c

index 3619dcf..0d2ac9e 100644 (file)
@@ -1383,11 +1383,11 @@ void cm_FreeServerList(cm_serverRef_t** list, afs_uint32 flags)
     cm_serverRef_t  **nextp = 0;
     cm_serverRef_t  * next = 0;
 
-       if (*list == NULL)
-               return;
-
     lock_ObtainWrite(&cm_serverLock);
 
+    if (*list == NULL)
+        goto done;
+
     while (*current)
     {
         nextp = &(*current)->next;
@@ -1409,6 +1409,8 @@ void cm_FreeServerList(cm_serverRef_t** list, afs_uint32 flags)
         }
     }
   
+  done:
+
     lock_ReleaseWrite(&cm_serverLock);
 }