From 65ff9935728e0142728e29295c7ef69bf73cecf4 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 30 Jan 2013 21:45:44 -0500 Subject: [PATCH] Windows: AFSInitPIOCtlDirectoryCB fixes Rename ObjectInfo parameter to ParentObjectInfo since it does represent the parent of the PIOCtlDirectoryCB that is being allocated. If the AFS_DIR_ENTRY_TAG allocation fails, do not call AFSDeleteObjectInfo( pObjectInfoCB) prior to the try_return because AFSDeleteObjectInfo() will be executed in the try_exit block. Finally, do not increment the pDirNode->ObjectInformationCB reference count when returning STATUS_REPARSE. The reference count is tracked by the pDirNode pointer and has already been allocated. Change-Id: Iac3d2b1b58d3bf12eb08c92b96beca43e794aef5 Reviewed-on: http://gerrit.openafs.org/8963 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp | 23 ++++------------------ 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp index 9bdd99d50..2f5e42a12 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp @@ -5844,7 +5844,7 @@ AFSVerifyVolume( IN ULONGLONG ProcessId, } NTSTATUS -AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo) +AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ParentObjectInfo) { NTSTATUS ntStatus = STATUS_SUCCESS; @@ -5857,7 +5857,7 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo) __Enter { - pObjectInfoCB = AFSAllocateObjectInfo( ObjectInfo, + pObjectInfoCB = AFSAllocateObjectInfo( ParentObjectInfo, 0); if( pObjectInfoCB == NULL) @@ -5888,8 +5888,6 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo) if( pDirNode == NULL) { - AFSDeleteObjectInfo( pObjectInfoCB); - try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES); } @@ -5941,28 +5939,15 @@ AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo) pDirNode->CaseInsensitiveTreeEntry.HashIndex = AFSGenerateCRC( &pDirNode->NameInformation.FileName, TRUE); - if ( InterlockedCompareExchangePointer( (PVOID *)&ObjectInfo->Specific.Directory.PIOCtlDirectoryCB, pDirNode, NULL) != NULL) + if ( InterlockedCompareExchangePointer( (PVOID *)&ParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB, pDirNode, NULL) != NULL) { AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING, AFS_TRACE_LEVEL_WARNING, "AFSInitPIOCtlDirectoryCB Raced PIOCtlDirectoryCB %p pFcb %p\n", - ObjectInfo->Specific.Directory.PIOCtlDirectoryCB, + ParentObjectInfo->Specific.Directory.PIOCtlDirectoryCB, pDirNode); - // - // Increment the open reference and handle on the node - // - - lCount = AFSObjectInfoIncrement( pDirNode->ObjectInformation, - AFS_OBJECT_REFERENCE_DIRENTRY); - - AFSDbgLogMsg( AFS_SUBSYSTEM_FCB_REF_COUNTING, - AFS_TRACE_LEVEL_VERBOSE, - "AFSInitPIOCtlDirectoryCB Increment count on Object %p Cnt %d\n", - pDirNode->ObjectInformation, - lCount); - try_return( ntStatus = STATUS_REPARSE); } -- 2.39.5