VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver/VolumeFilter.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-14 23:10:38 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-15 00:02:38 +0200
commite95c075f0cce01afa3b0367b2345b81a6a16cc5c (patch)
tree87f12536420972fb37bc9f3954ce0bdbebc8782b /src/Driver/VolumeFilter.c
parent4a5154e750fe5f5d764664328dd15c2deafa57b1 (diff)
downloadVeraCrypt-e95c075f0cce01afa3b0367b2345b81a6a16cc5c.tar.gz
VeraCrypt-e95c075f0cce01afa3b0367b2345b81a6a16cc5c.zip
Windows driver: avoid race condition by using IoAttachDeviceToDeviceStackSafe instead IoAttachDeviceToDeviceStack. Set BootArgs.CryptoInfoLength to 0 after clearing boot memory.
Diffstat (limited to 'src/Driver/VolumeFilter.c')
-rw-r--r--src/Driver/VolumeFilter.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Driver/VolumeFilter.c b/src/Driver/VolumeFilter.c
index 9789fe0f..ee4b02e7 100644
--- a/src/Driver/VolumeFilter.c
+++ b/src/Driver/VolumeFilter.c
@@ -42,7 +42,12 @@ NTSTATUS VolumeFilterAddDevice (PDRIVER_OBJECT driverObject, PDEVICE_OBJECT pdo)
Extension = (VolumeFilterExtension *) filterDeviceObject->DeviceExtension;
memset (Extension, 0, sizeof (VolumeFilterExtension));
- Extension->LowerDeviceObject = IoAttachDeviceToDeviceStack (filterDeviceObject, pdo); // IoAttachDeviceToDeviceStackSafe() is not required in AddDevice routine and is also unavailable on Windows 2000 SP4
+ status = IoAttachDeviceToDeviceStackSafe (filterDeviceObject, pdo, &(Extension->LowerDeviceObject));
+ if (status != STATUS_SUCCESS)
+ {
+ goto err;
+ }
+
if (!Extension->LowerDeviceObject)
{
status = STATUS_DEVICE_REMOVED;