[FASTFAT] Avoid a use after free in VfatCloseFile.

This commit is contained in:
Thomas Faber 2019-01-12 16:25:52 +01:00
parent bc8307205b
commit bc002f1708
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -163,6 +163,7 @@ VfatCloseFile(
{
PVFATFCB pFcb;
PVFATCCB pCcb;
BOOLEAN IsVolume;
NTSTATUS Status = STATUS_SUCCESS;
DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
@ -177,6 +178,8 @@ VfatCloseFile(
return STATUS_SUCCESS;
}
IsVolume = BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME);
if (pCcb)
{
vfatDestroyCCB(pCcb);
@ -194,7 +197,7 @@ VfatCloseFile(
FileObject->SectionObjectPointer = NULL;
#ifdef ENABLE_SWAPOUT
if (BooleanFlagOn(pFcb->Flags, FCB_IS_VOLUME) && DeviceExt->OpenHandleCount == 0)
if (IsVolume && DeviceExt->OpenHandleCount == 0)
{
VfatCheckForDismount(DeviceExt, FALSE);
}