Author: tfaber
Date: Wed Nov 5 19:06:19 2014
New Revision: 65270
URL:
http://svn.reactos.org/svn/reactos?rev=65270&view=rev
Log:
[FASTFAT]
- Assert that we never reference or dereference an FCB with RefCount 0
CORE-8733
Modified:
trunk/reactos/drivers/filesystems/fastfat/fcb.c
Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Wed Nov 5 19:06:19 2014
@@ -295,6 +295,7 @@
ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource));
ASSERT(pFCB != pVCB->VolumeFcb);
+ ASSERT(pFCB->RefCount > 0);
++pFCB->RefCount;
}
@@ -313,6 +314,7 @@
while (pFCB)
{
ASSERT(pFCB != pVCB->VolumeFcb);
+ ASSERT(pFCB->RefCount > 0);
pFCB->RefCount--;
if (pFCB->RefCount == 0)
{
@@ -497,7 +499,6 @@
fileObject->FsContext = fcb;
fileObject->FsContext2 = newCCB;
fcb->FileObject = fileObject;
- vfatGrabFCB(vcb, fcb);
_SEH2_TRY
{
@@ -510,7 +511,6 @@
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
status = _SEH2_GetExceptionCode();
- fcb->RefCount--;
fcb->FileObject = NULL;
ExFreeToNPagedLookasideList(&VfatGlobalData->CcbLookasideList, newCCB);
ObDereferenceObject(fileObject);
@@ -518,6 +518,7 @@
}
_SEH2_END;
+ vfatGrabFCB(vcb, fcb);
fcb->Flags |= FCB_CACHE_INITIALIZED;
return STATUS_SUCCESS;
}
@@ -663,7 +664,7 @@
rcFCB->RFCB.FileSize.QuadPart = Size;
rcFCB->RFCB.ValidDataLength.QuadPart = Size;
rcFCB->RFCB.AllocationSize.QuadPart = ROUND_UP(Size,
vcb->FatInfo.BytesPerCluster);
- vfatGrabFCB(vcb, rcFCB);
+ rcFCB->RefCount = 1;
if (vfatFCBIsDirectory(rcFCB))
{
vfatFCBInitializeCacheFromVolume(vcb, rcFCB);