- We forget that AE_BUFFER_OVERFLOW is normal and expected since our buffer length is 0 so don't fail if that status is returned

- For any device that actually had resources we would return STATUS_SUCCESS without building a resource list and if the device didn't have resources we would end up freeing a NULL pointer, storing stack trash in Irp->IoStatus.Information, and then returning STATUS_SUCCESS
 - Fixes reporting device resources (and possibly the VBox additions crash with ACPI enabled)

svn path=/trunk/; revision=46080
This commit is contained in:
Cameron Gutman 2010-03-10 22:25:40 +00:00
parent 418f2cc0e1
commit 1733eb0a2f

View file

@ -598,24 +598,24 @@ Bus_PDO_QueryResources(
/* Get current resources */
Buffer.Length = 0;
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
Buffer.Length == 0)
{
return Irp->IoStatus.Status;
}
Buffer.Pointer = ExAllocatePool(PagedPool, Buffer.Length);
if (!Buffer.Pointer)
return STATUS_INSUFFICIENT_RESOURCES;
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if (!ACPI_SUCCESS(AcpiStatus))
{
return STATUS_SUCCESS;
DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
ASSERT(FALSE);
return STATUS_UNSUCCESSFUL;
}
if (Buffer.Length > 0)
{
Buffer.Pointer = ExAllocatePool(PagedPool, Buffer.Length);
if (!Buffer.Pointer)
{
ASSERT(FALSE);
}
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if (!ACPI_SUCCESS(AcpiStatus))
{
ASSERT(FALSE);
}
}
resource= Buffer.Pointer;
/* Count number of resources */
@ -775,24 +775,24 @@ Bus_PDO_QueryResourceRequirements(
/* Get current resources */
Buffer.Length = 0;
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
Buffer.Length == 0)
{
return Irp->IoStatus.Status;
}
Buffer.Pointer = ExAllocatePool(PagedPool, Buffer.Length);
if (!Buffer.Pointer)
return STATUS_INSUFFICIENT_RESOURCES;
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if (!ACPI_SUCCESS(AcpiStatus))
{
return STATUS_SUCCESS;
DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
ASSERT(FALSE);
return STATUS_UNSUCCESSFUL;
}
if (Buffer.Length > 0)
{
Buffer.Pointer = ExAllocatePool(PagedPool, Buffer.Length);
if (!Buffer.Pointer)
{
ASSERT(FALSE);
}
AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
if (!ACPI_SUCCESS(AcpiStatus))
{
ASSERT(FALSE);
}
}
resource= Buffer.Pointer;
/* Count number of resources */