Windows: AFSInvalidateVolume ObjectInfo refcnt decrement
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 12 Apr 2013 15:12:13 +0000 (11:12 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 26 Apr 2013 13:23:10 +0000 (06:23 -0700)
In AFSInvalidateVolume a reference count is obtained in order to
ensure that the object is valid throughout the invalidation request.
Although the refcnt is obtained while holding the TreeLock the refcnt
was not released while holding the TreeLock which could open the door
for another thread to race.

Change-Id: I5c7ee91b78a2ce5f03cdc5f835b15357ecbec443
Reviewed-on: http://gerrit.openafs.org/9782
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp

index 3acfa8e..2c4dc07 100644 (file)
@@ -2759,6 +2759,9 @@ AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
             AFSInvalidateObject( &pCurrentObject,
                                  Reason);
 
+            AFSAcquireShared( VolumeCB->ObjectInfoTree.TreeLock,
+                              TRUE);
+
             if ( pCurrentObject )
             {
 
@@ -2772,9 +2775,6 @@ AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
                               lCount));
             }
 
-            AFSAcquireShared( VolumeCB->ObjectInfoTree.TreeLock,
-                              TRUE);
-
             pCurrentObject = pNextObject;
         }