From: Jeffrey Altman Date: Thu, 14 Feb 2013 19:43:58 +0000 (-0500) Subject: Windows: Ensure pResultCB exists before Authentication X-Git-Tag: openafs-stable-1_8_0pre1~1541 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=7c31bd5e2d0da3a1c9e29337d5a90147f3b03158 Windows: Ensure pResultCB exists before Authentication 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/user/RDRInit.cpp b/src/WINNT/afsrdr/user/RDRInit.cpp index ad68376..05f8bac 100644 --- a/src/WINNT/afsrdr/user/RDRInit.cpp +++ b/src/WINNT/afsrdr/user/RDRInit.cpp @@ -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