]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Ensure pResultCB exists before Authentication
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 14 Feb 2013 19:43:58 +0000 (14:43 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 14 Feb 2013 20:29:20 +0000 (12:29 -0800)
When processing requests from the redirector it is possible for
the ResultCB to not be allocated.  This can occur either due to
an out of memory condition in a synchronous request or due to
an asynchronous extents or byte range lock request.

Move the assignment of the Authenticated state after the allocation
of the ResultCB from the stack in case of out of memory conditions.

Change-Id: I7e98edde712b532010aa15705a62cf91dd9d0ebf
Reviewed-on: http://gerrit.openafs.org/9110
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
src/WINNT/afsrdr/user/RDRInit.cpp

index ad68376dbd70fbbb1063bb974feff61331d3898c..05f8bacbd93133febb803e41e036fd4c0670956b 100644 (file)
@@ -1322,14 +1322,10 @@ RDR_ProcessRequest( AFSCommRequest *RequestBuffer)
             break;
     }
 
-    if (userp) {
-        pResultCB->Authenticated = cm_HaveToken( userp,
-                                                 RequestBuffer->FileId.Cell);
-    }
-
     if( BooleanFlagOn( RequestBuffer->RequestFlags, AFS_REQUEST_FLAG_SYNCHRONOUS))
     {
-       if (pResultCB == NULL) {
+
+        if (pResultCB == NULL) {
            // We failed probably due to a memory allocation error
             // unless the unsupported flag was set.
            pResultCB = &stResultCB;
@@ -1340,6 +1336,11 @@ RDR_ProcessRequest( AFSCommRequest *RequestBuffer)
                 pResultCB->ResultStatus = STATUS_NO_MEMORY;
        }
 
+        if (userp) {
+            pResultCB->Authenticated = cm_HaveToken( userp,
+                                                     RequestBuffer->FileId.Cell);
+        }
+
         //
         // This is how the filter associates the response information passed in the IOCtl below to the
         // original call. This request index is setup by the filter and should not be modified, otherwise the