From 38ce67162f705c46ed33d06a959b23def370dfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 24 Sep 2021 17:51:40 +0200 Subject: [PATCH] [FS_REC] Fix load-lock acquisition. --- drivers/filesystems/fs_rec/fs_rec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/filesystems/fs_rec/fs_rec.c b/drivers/filesystems/fs_rec/fs_rec.c index 2bd4da6da64..4ccb99f5952 100644 --- a/drivers/filesystems/fs_rec/fs_rec.c +++ b/drivers/filesystems/fs_rec/fs_rec.c @@ -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; }