From 7b1115d47019a9948c574ebad7b1323a30b16ab6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 2 Oct 2012 21:09:35 -0400 Subject: [PATCH] Windows: AFSInitFcb assign pFcb->ObjectInformation In AFSInitFcb() assign pFcb->ObjectInformation before the InterlockedExchangePointer call and not afterwards. Assigning it afterwards leaves a small race where the ObjectInformation value will be invalid. Change-Id: Ie79587e0b2f161b7ff612fc4fb283135bafd1085 Reviewed-on: http://gerrit.openafs.org/8222 Reviewed-by: Rod Widdowson Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp index 1e09d83695..38d588b782 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp @@ -260,8 +260,11 @@ AFSInitFcb( IN AFSDirectoryCB *DirEntry) pFcb->Header.NodeTypeCode = AFS_INVALID_FCB; } + pFcb->ObjectInformation = pObjectInfo; + // - // Initialize some fields in the Fcb + // Swap the allocated FCB into the ObjectInformation structure if it + // does not already have one. // if ( InterlockedCompareExchangePointer( (PVOID *)&pObjectInfo->Fcb, pFcb, NULL) != NULL) @@ -286,8 +289,6 @@ AFSInitFcb( IN AFSDirectoryCB *DirEntry) try_return( ntStatus = STATUS_REPARSE); } - pFcb->ObjectInformation = pObjectInfo; - AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, AFS_TRACE_LEVEL_VERBOSE, "AFSInitFcb Initialized Fcb %08lX Name %wZ\n",