mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 16:31:21 +00:00
[NTOSKRNL]
- Remove an unused member from PNPROOT_DEVICE - Don't build a bogus resource list if no resources are required - Fixes a crash during resource arbitration because the created resource requirements list was malformed svn path=/trunk/; revision=46710
This commit is contained in:
parent
e0b95b05b0
commit
93c0c968c0
1 changed files with 18 additions and 32 deletions
|
@ -33,7 +33,6 @@ typedef struct _PNPROOT_DEVICE
|
||||||
UNICODE_STRING DeviceDescription;
|
UNICODE_STRING DeviceDescription;
|
||||||
// Resource requirement list
|
// Resource requirement list
|
||||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
||||||
ULONG ResourceRequirementsListSize;
|
|
||||||
// Associated resource list
|
// Associated resource list
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
ULONG ResourceListSize;
|
ULONG ResourceListSize;
|
||||||
|
@ -766,18 +765,7 @@ PdoQueryResources(
|
||||||
|
|
||||||
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
if (DeviceExtension->DeviceInfo->ResourceList == NULL)
|
if (DeviceExtension->DeviceInfo->ResourceList)
|
||||||
{
|
|
||||||
/* Create an empty resource list */
|
|
||||||
ResourceList = ExAllocatePool(PagedPool, sizeof(CM_RESOURCE_LIST));
|
|
||||||
if (!ResourceList)
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
|
|
||||||
ResourceList->Count = 0;
|
|
||||||
|
|
||||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* Copy existing resource requirement list */
|
/* Copy existing resource requirement list */
|
||||||
ResourceList = ExAllocatePool(
|
ResourceList = ExAllocatePool(
|
||||||
|
@ -792,9 +780,14 @@ PdoQueryResources(
|
||||||
DeviceExtension->DeviceInfo->ResourceListSize);
|
DeviceExtension->DeviceInfo->ResourceListSize);
|
||||||
|
|
||||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No resources so just return without changing the status */
|
||||||
|
return Irp->IoStatus.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
@ -805,23 +798,10 @@ PdoQueryResourceRequirements(
|
||||||
{
|
{
|
||||||
PPNPROOT_PDO_DEVICE_EXTENSION DeviceExtension;
|
PPNPROOT_PDO_DEVICE_EXTENSION DeviceExtension;
|
||||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceList;
|
PIO_RESOURCE_REQUIREMENTS_LIST ResourceList;
|
||||||
ULONG ResourceListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List);
|
|
||||||
|
|
||||||
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
DeviceExtension = (PPNPROOT_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
if (DeviceExtension->DeviceInfo->ResourceRequirementsList == NULL)
|
if (DeviceExtension->DeviceInfo->ResourceRequirementsList)
|
||||||
{
|
|
||||||
/* Create an empty resource list */
|
|
||||||
ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
|
|
||||||
if (!ResourceList)
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
|
|
||||||
RtlZeroMemory(ResourceList, ResourceListSize);
|
|
||||||
ResourceList->ListSize = ResourceListSize;
|
|
||||||
|
|
||||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* Copy existing resource requirement list */
|
/* Copy existing resource requirement list */
|
||||||
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize);
|
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize);
|
||||||
|
@ -832,10 +812,16 @@ PdoQueryResourceRequirements(
|
||||||
ResourceList,
|
ResourceList,
|
||||||
DeviceExtension->DeviceInfo->ResourceRequirementsList,
|
DeviceExtension->DeviceInfo->ResourceRequirementsList,
|
||||||
DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize);
|
DeviceExtension->DeviceInfo->ResourceRequirementsList->ListSize);
|
||||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No resource requirements so just return without changing the status */
|
||||||
|
return Irp->IoStatus.Status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue