This commit is contained in:
Bill Zissimopoulos 2015-11-30 11:10:48 -08:00
parent b52947db34
commit f188bddb3b
3 changed files with 9 additions and 19 deletions

View File

@ -22,7 +22,6 @@ static NTSTATUS FspFsvolDeviceInit(PDEVICE_OBJECT DeviceObject);
static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject); static VOID FspFsvolDeviceFini(PDEVICE_OBJECT DeviceObject);
BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject); BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject);
VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject); VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject);
BOOLEAN FspDeviceDeleted(PDEVICE_OBJECT DeviceObject);
NTSTATUS FspDeviceCopyList( NTSTATUS FspDeviceCopyList(
PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount); PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount);
VOID FspDeviceDeleteList( VOID FspDeviceDeleteList(
@ -243,22 +242,6 @@ VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject)
FspDeviceDelete(DeviceObject); FspDeviceDelete(DeviceObject);
} }
BOOLEAN FspDeviceDeleted(PDEVICE_OBJECT DeviceObject)
{
// !PAGED_CODE();
BOOLEAN Result;
FSP_DEVICE_EXTENSION *DeviceExtension;
KIRQL Irql;
DeviceExtension = FspDeviceExtension(DeviceObject);
KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql);
Result = 0 == DeviceExtension->RefCount;
KeReleaseSpinLock(&DeviceExtension->SpinLock, Irql);
return Result;
}
NTSTATUS FspDeviceCopyList( NTSTATUS FspDeviceCopyList(
PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount) PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount)
{ {

View File

@ -310,7 +310,6 @@ NTSTATUS FspDeviceCreate(UINT32 Kind, ULONG ExtraSize,
VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject); VOID FspDeviceDelete(PDEVICE_OBJECT DeviceObject);
BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject); BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject);
VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject); VOID FspDeviceRelease(PDEVICE_OBJECT DeviceObject);
BOOLEAN FspDeviceDeleted(PDEVICE_OBJECT DeviceObject);
NTSTATUS FspDeviceCopyList( NTSTATUS FspDeviceCopyList(
PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount); PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount);
VOID FspDeviceDeleteList( VOID FspDeviceDeleteList(

View File

@ -192,9 +192,15 @@ static NTSTATUS FspFsctlMountVolume(
Result = STATUS_UNRECOGNIZED_VOLUME; Result = STATUS_UNRECOGNIZED_VOLUME;
goto exit; goto exit;
} }
if (FspDeviceDeleted(FsvrtDeviceObject) || FsvrtDeviceExtension->Deleted || if (!FspDeviceRetain(FsvrtDeviceObject))
{
Result = STATUS_UNRECOGNIZED_VOLUME;
goto exit;
}
if (FsvrtDeviceExtension->Deleted ||
FILE_DEVICE_VIRTUAL_DISK != FsvrtDeviceObject->DeviceType) FILE_DEVICE_VIRTUAL_DISK != FsvrtDeviceObject->DeviceType)
{ {
FspDeviceRelease(FsvrtDeviceObject);
Result = STATUS_UNRECOGNIZED_VOLUME; Result = STATUS_UNRECOGNIZED_VOLUME;
goto exit; goto exit;
} }
@ -215,6 +221,8 @@ static NTSTATUS FspFsctlMountVolume(
Irp->IoStatus.Information = 0; Irp->IoStatus.Information = 0;
} }
FspDeviceRelease(FsvrtDeviceObject);
exit:; exit:;
} }
finally finally