[FASTFAT] Misc. fixes spotted by Thomas.

This commit is contained in:
Pierre Schweitzer 2018-05-19 10:07:14 +02:00
parent 7c01587680
commit d69f31848e
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -29,6 +29,7 @@ vfatFCBInitializeCacheFromVolume(
PVFATCCB newCCB;
NTSTATUS status;
BOOLEAN Acquired;
NTSTATUS Status;
/* Don't re-initialize if already done */
if (BooleanFlagOn(fcb->Flags, FCB_CACHE_INITIALIZED))
@ -58,8 +59,9 @@ vfatFCBInitializeCacheFromVolume(
newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);
if (newCCB == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
ObDereferenceObject(fileObject);
return STATUS_INSUFFICIENT_RESOURCES;
goto Quit;
}
RtlZeroMemory(newCCB, sizeof (VFATCCB));
@ -83,19 +85,25 @@ vfatFCBInitializeCacheFromVolume(
fcb->FileObject = NULL;
ExFreeToNPagedLookasideList(&VfatGlobalData->CcbLookasideList, newCCB);
ObDereferenceObject(fileObject);
if (Acquired)
{
ExReleaseResourceLite(&vcb->DirResource);
}
return status;
}
_SEH2_END;
vfatGrabFCB(vcb, fcb);
SetFlag(fcb->Flags, FCB_CACHE_INITIALIZED);
Status = STATUS_SUCCESS;
Quit:
if (Acquired)
{
ExReleaseResourceLite(&vcb->DirResource);
}
return STATUS_SUCCESS;
return Status;
}
/*
@ -682,6 +690,7 @@ FATAddEntry(
}
/* No need to init cache here, vfatFindDirSpace() will have done it for us */
ASSERT(BooleanFlagOn(ParentFcb->Flags, FCB_CACHE_INITIALIZED));
i = DeviceExt->FatInfo.BytesPerCluster / sizeof(FAT_DIR_ENTRY);
FileOffset.u.HighPart = 0;
@ -768,6 +777,7 @@ FATAddEntry(
Status = vfatFCBInitializeCacheFromVolume(DeviceExt, (*Fcb));
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(Buffer, TAG_VFAT);
return Status;
}
@ -898,6 +908,7 @@ FATXAddEntry(
}
/* No need to init cache here, vfatFindDirSpace() will have done it for us */
ASSERT(BooleanFlagOn(ParentFcb->Flags, FCB_CACHE_INITIALIZED));
/* add entry into parent directory */
FileOffset.u.HighPart = 0;