Windows: AFSInitFcb STATUS_REPARSE cleanup

If a race is detected when creating a new File Control Block in
AFSInitFcb() the Fcb Header must be torn down and the ExtentsResource
and DirtyExtentsListLock must be deleted prior to freeing the pool
memory.

Change-Id: I3c3f45aed26ea62b4d20e5c5e80d1237d96c912c
Reviewed-on: http://gerrit.openafs.org/7326
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Jeffrey Altman 2012-05-03 19:58:31 -04:00 committed by Jeffrey Altman
parent f12a20e227
commit e691a757d6

View File

@ -59,7 +59,6 @@ AFSInitFcb( IN AFSDirectoryCB *DirEntry)
AFSFcb *pFcb = NULL;
AFSNonPagedFcb *pNPFcb = NULL;
IO_STATUS_BLOCK stIoSb = {0,0};
BOOLEAN bUninitFileLock = FALSE;
USHORT usFcbLength = 0;
ULONGLONG ullIndex = 0;
AFSDirEnumEntry *pDirEnumCB = NULL;
@ -193,8 +192,6 @@ AFSInitFcb( IN AFSDirectoryCB *DirEntry)
NULL,
NULL);
bUninitFileLock = TRUE;
//
// Initialize the header file sizes to our dir entry information
//
@ -314,32 +311,34 @@ try_exit:
if( pFcb != NULL)
{
if( bUninitFileLock)
{
FsRtlUninitializeFileLock( &pFcb->Specific.File.FileLock);
}
if( pNPFcb != NULL)
{
AFSReleaseResource( &pNPFcb->Resource);
FsRtlTeardownPerStreamContexts( &pFcb->Header);
if ( pObjectInfo->FileType == AFS_FILE_TYPE_FILE)
{
FsRtlUninitializeFileLock( &pFcb->Specific.File.FileLock);
ExDeleteResourceLite( &pNPFcb->Specific.File.ExtentsResource);
ExDeleteResourceLite( &pNPFcb->Specific.File.DirtyExtentsListLock);
}
ExDeleteResourceLite( &pNPFcb->PagingResource);
ExDeleteResourceLite( &pNPFcb->CcbListLock);
ExDeleteResourceLite( &pNPFcb->Resource);
AFSExFreePool( pNPFcb);
}
AFSExFreePool( pFcb);
}
if( pNPFcb != NULL)
{
AFSExFreePool( pNPFcb);
}
}
}