[FS_REC] Fix load-lock acquisition.

This commit is contained in:
Hermès Bélusca-Maïto 2021-09-24 17:51:40 +02:00
parent 618076dc47
commit 38ce67162f
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -23,21 +23,22 @@ NTAPI
FsRecLoadFileSystem(IN PDEVICE_OBJECT DeviceObject,
IN PWCHAR DriverServiceName)
{
UNICODE_STRING DriverName;
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
NTSTATUS Status = STATUS_IMAGE_ALREADY_LOADED;
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
UNICODE_STRING DriverName;
PAGED_CODE();
/* Make sure we haven't already been called */
if (DeviceExtension->State != Loaded)
{
/* Acquire the load lock */
KeEnterCriticalRegion();
KeWaitForSingleObject(FsRecLoadSync,
Executive,
KernelMode,
FALSE,
NULL);
KeEnterCriticalRegion();
/* Make sure we're active */
if (DeviceExtension->State == Pending)
@ -67,11 +68,10 @@ FsRecLoadFileSystem(IN PDEVICE_OBJECT DeviceObject,
}
/* Release the lock */
KeSetEvent(FsRecLoadSync, 0, FALSE);
KeSetEvent(FsRecLoadSync, IO_NO_INCREMENT, FALSE);
KeLeaveCriticalRegion();
}
/* Return */
return Status;
}