mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 09:11:42 +00:00
- Dereference the Fdo before we return if we fail
- Fail if we can't allocate memory - Also resize the buffer if we get STATUS_BUFFER_TOO_SMALL svn path=/trunk/; revision=36068
This commit is contained in:
parent
5b75a3dfd7
commit
c1c6da32a4
1 changed files with 18 additions and 6 deletions
|
@ -100,6 +100,7 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
{
|
{
|
||||||
/* FIXME: What do we do? Unload the driver or just disable the device? */
|
/* FIXME: What do we do? Unload the driver or just disable the device? */
|
||||||
DPRINT1("An FDO was not attached\n");
|
DPRINT1("An FDO was not attached\n");
|
||||||
|
ObDereferenceObject(Fdo);
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
@ -305,6 +306,12 @@ IopGetBusTypeGuidIndex(LPGUID BusTypeGuid)
|
||||||
/* Allocate the new copy */
|
/* Allocate the new copy */
|
||||||
NewList = ExAllocatePool(PagedPool, NewSize);
|
NewList = ExAllocatePool(PagedPool, NewSize);
|
||||||
|
|
||||||
|
if (!NewList) {
|
||||||
|
/* Fail */
|
||||||
|
ExFreePool(IopBusTypeGuidList);
|
||||||
|
goto Quickie;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now copy them, decrease the size too */
|
/* Now copy them, decrease the size too */
|
||||||
NewSize -= sizeof(GUID);
|
NewSize -= sizeof(GUID);
|
||||||
RtlCopyMemory(NewList, IopBusTypeGuidList, NewSize);
|
RtlCopyMemory(NewList, IopBusTypeGuidList, NewSize);
|
||||||
|
@ -2186,7 +2193,7 @@ IopEnumerateDetectedDevices(
|
||||||
Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_NO_MORE_ENTRIES)
|
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||||
break;
|
break;
|
||||||
else if (Status == STATUS_BUFFER_OVERFLOW)
|
else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pDeviceInformation);
|
ExFreePool(pDeviceInformation);
|
||||||
DeviceInfoLength = RequiredSize;
|
DeviceInfoLength = RequiredSize;
|
||||||
|
@ -2220,7 +2227,7 @@ IopEnumerateDetectedDevices(
|
||||||
|
|
||||||
/* Read boot resources, and add then to parent ones */
|
/* Read boot resources, and add then to parent ones */
|
||||||
Status = ZwQueryValueKey(hDeviceKey, &ConfigurationDataU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
Status = ZwQueryValueKey(hDeviceKey, &ConfigurationDataU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_BUFFER_OVERFLOW)
|
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pValueInformation);
|
ExFreePool(pValueInformation);
|
||||||
ValueInfoLength = RequiredSize;
|
ValueInfoLength = RequiredSize;
|
||||||
|
@ -2302,7 +2309,7 @@ IopEnumerateDetectedDevices(
|
||||||
Status = ZwEnumerateKey(hDeviceKey, IndexSubKey, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
Status = ZwEnumerateKey(hDeviceKey, IndexSubKey, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_NO_MORE_ENTRIES)
|
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||||
break;
|
break;
|
||||||
else if (Status == STATUS_BUFFER_OVERFLOW)
|
else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pDeviceInformation);
|
ExFreePool(pDeviceInformation);
|
||||||
DeviceInfoLength = RequiredSize;
|
DeviceInfoLength = RequiredSize;
|
||||||
|
@ -2338,7 +2345,7 @@ IopEnumerateDetectedDevices(
|
||||||
|
|
||||||
/* Read identifier */
|
/* Read identifier */
|
||||||
Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_BUFFER_OVERFLOW)
|
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pValueInformation);
|
ExFreePool(pValueInformation);
|
||||||
ValueInfoLength = RequiredSize;
|
ValueInfoLength = RequiredSize;
|
||||||
|
@ -2579,7 +2586,7 @@ IopIsAcpiComputer(VOID)
|
||||||
Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_NO_MORE_ENTRIES)
|
if (Status == STATUS_NO_MORE_ENTRIES)
|
||||||
break;
|
break;
|
||||||
else if (Status == STATUS_BUFFER_OVERFLOW)
|
else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pDeviceInformation);
|
ExFreePool(pDeviceInformation);
|
||||||
DeviceInfoLength = RequiredSize;
|
DeviceInfoLength = RequiredSize;
|
||||||
|
@ -2615,7 +2622,7 @@ IopIsAcpiComputer(VOID)
|
||||||
|
|
||||||
/* Read identifier */
|
/* Read identifier */
|
||||||
Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize);
|
||||||
if (Status == STATUS_BUFFER_OVERFLOW)
|
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
ExFreePool(pValueInformation);
|
ExFreePool(pValueInformation);
|
||||||
ValueInfoLength = RequiredSize;
|
ValueInfoLength = RequiredSize;
|
||||||
|
@ -2839,6 +2846,11 @@ PnpInit(VOID)
|
||||||
|
|
||||||
/* Initialize the Bus Type GUID List */
|
/* Initialize the Bus Type GUID List */
|
||||||
IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
|
IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
|
||||||
|
if (!IopBusTypeGuidList) {
|
||||||
|
DPRINT1("ExAllocatePool() failed\n");
|
||||||
|
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, STATUS_NO_MEMORY, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
|
RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
|
||||||
ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
|
ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue