Author: tfaber
Date: Wed Nov 5 23:23:52 2014
New Revision: 65276
URL:
http://svn.reactos.org/svn/reactos?rev=65276&view=rev
Log:
[FASTFAT]
- Fix incorrect referencing in VfatCreateFile. vfatGetFCBForFile expects a reference on
ParentFcb (and may release it), and also returns a referenced parent FCB.
CORE-8756 #resolve
Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
trunk/reactos/drivers/filesystems/fastfat/direntry.c
trunk/reactos/drivers/filesystems/fastfat/dirwr.c
Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Wed Nov 5 23:23:52
2014
@@ -565,11 +565,14 @@
LONG idx, FileNameLen;
ParentFcb = (FileObject->RelatedFileObject != NULL) ?
FileObject->RelatedFileObject->FsContext : NULL;
+ if (ParentFcb)
+ {
+ vfatGrabFCB(DeviceExt, ParentFcb);
+ }
Status = vfatGetFCBForFile(DeviceExt, &ParentFcb, &TargetFcb,
&PathNameU);
- if (Status == STATUS_SUCCESS)
- {
- vfatGrabFCB(DeviceExt, ParentFcb);
+ if (NT_SUCCESS(Status))
+ {
vfatReleaseFCB(DeviceExt, TargetFcb);
Irp->IoStatus.Information = FILE_EXISTS;
}
@@ -623,6 +626,7 @@
if (NT_SUCCESS(Status))
{
pFcb = FileObject->FsContext;
+ ASSERT(pFcb == ParentFcb);
if (pFcb->OpenHandleCount == 0)
{
@@ -640,7 +644,6 @@
FALSE);
if (!NT_SUCCESS(Status))
{
- vfatReleaseFCB(DeviceExt, ParentFcb);
VfatCloseFile(DeviceExt, FileObject);
return Status;
}
Modified: trunk/reactos/drivers/filesystems/fastfat/direntry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/direntry.c [iso-8859-1] Wed Nov 5 23:23:52
2014
@@ -201,12 +201,6 @@
CcUnpinData(*pContext);
}
- if (!pDirFcb->FileObject)
- {
- DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n",
pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount);
- return STATUS_NO_MORE_ENTRIES;
- }
-
if (FileOffset.u.LowPart >= pDirFcb->RFCB.FileSize.u.LowPart ||
!CcMapData(pDirFcb->FileObject, &FileOffset, PAGE_SIZE, TRUE,
pContext, pPage))
{
Modified: trunk/reactos/drivers/filesystems/fastfat/dirwr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] Wed Nov 5 23:23:52
2014
@@ -166,11 +166,6 @@
if (Context)
{
CcUnpinData(Context);
- }
- if (!pDirFcb->FileObject)
- {
- DPRINT1("Buggy FCB (cleaned up)! %S (%d / %u)\n",
pDirFcb->PathNameBuffer, pDirFcb->RefCount, pDirFcb->OpenHandleCount);
- return FALSE;
}
if (!CcPinRead(pDirFcb->FileObject, &FileOffset,
DeviceExt->FatInfo.BytesPerCluster,
TRUE, &Context, (PVOID*)&pFatEntry))