Author: cgutman
Date: Wed Mar 10 23:25:40 2010
New Revision: 46080
URL:
http://svn.reactos.org/svn/reactos?rev=46080&view=rev
Log:
- 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)
Modified:
trunk/reactos/drivers/bus/acpi/buspdo.c
Modified: trunk/reactos/drivers/bus/acpi/buspdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/buspdo.c?…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/buspdo.c [iso-8859-1] Wed Mar 10 23:25:40 2010
@@ -599,23 +599,23 @@
/* 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;
- }
- 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);
- }
- }
+ DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
+ ASSERT(FALSE);
+ return STATUS_UNSUCCESSFUL;
+ }
resource= Buffer.Pointer;
/* Count number of resources */
@@ -776,23 +776,23 @@
/* 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;
- }
- 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);
- }
- }
+ DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
+ ASSERT(FALSE);
+ return STATUS_UNSUCCESSFUL;
+ }
resource= Buffer.Pointer;
/* Count number of resources */