[NTOSKRNL]

- Fix kernel memory corruption when a driver fails to initialize
- Fix a handle leak in a failure case

svn path=/trunk/; revision=55887
This commit is contained in:
Cameron Gutman 2012-02-27 19:31:11 +00:00
parent c61e296b73
commit ac6c5a4738

View file

@ -1538,6 +1538,10 @@ try_again:
KernelMode,
(PVOID*)&DriverObject,
NULL);
/* Close the extra handle */
ZwClose(hDriver);
if (!NT_SUCCESS(Status))
{
/* Fail */
@ -1546,9 +1550,6 @@ try_again:
return Status;
}
/* Close the extra handle */
ZwClose(hDriver);
DriverObject->HardwareDatabase = &IopHardwareDatabaseKey;
DriverObject->DriverStart = ModuleObject ? ModuleObject->DllBase : 0;
DriverObject->DriverSize = ModuleObject ? ModuleObject->SizeOfImage : 0;
@ -1564,6 +1565,7 @@ try_again:
DriverObject->DriverSection = NULL;
ObMakeTemporaryObject(DriverObject);
ObDereferenceObject(DriverObject);
return Status;
}
else
{