ACPI: Set length even for TYPE_END_TAG acpi resource
authorYinghai Lu <yinghai@kernel.org>
Sat, 23 Mar 2013 19:16:37 +0000 (19:16 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 24 Mar 2013 00:00:38 +0000 (01:00 +0100)
Found with a network device in QEMU/KVM guest not working anymore.

Bisected to commit c13085e5
    ACPICA: Resource Mgr: Prevent infinite loops in resource walks

That commit will check acpi_resource length strictly which causes
acpi_set_current_resources to return failure and IRQ for PCI
devices is not set properly.

Set length for all those TYPE_END_TAG acpi_resources.

[rjw: Changelog]
Bisected-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/pci_link.c
drivers/platform/x86/sony-laptop.c
drivers/pnp/pnpacpi/rsparser.c

index ab764ed34a502aea838f4a70b0478ae73543873d..2652a614deebe8062c71bb4e3c7f26fe8d315a45 100644 (file)
@@ -354,6 +354,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
 
        }
        resource->end.type = ACPI_RESOURCE_TYPE_END_TAG;
+       resource->end.length = sizeof(struct acpi_resource);
 
        /* Attempt to set the resource */
        status = acpi_set_current_resources(link->device->handle, &buffer);
index 14d4dced1defb26862bbb11f3cf37848ded3e40e..d544e3aaf76141754b622aada806b04050fe2886 100644 (file)
@@ -4121,7 +4121,7 @@ static int sony_pic_enable(struct acpi_device *device,
                resource->res3.data.irq.sharable = ACPI_SHARED;
 
                resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
-
+               resource->res4.length = sizeof(struct acpi_resource);
        }
        /* setup Type 2/3 resources */
        else {
@@ -4140,6 +4140,7 @@ static int sony_pic_enable(struct acpi_device *device,
                resource->res2.data.irq.sharable = ACPI_SHARED;
 
                resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
+               resource->res3.length = sizeof(struct acpi_resource);
        }
 
        /* Attempt to set the resource */
index b8f4ea7b27fc0efea8e932aac4f9390006c6ec70..9847ab163829f60d7311c83f3c57a0eb32d767f1 100644 (file)
@@ -634,6 +634,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
        }
        /* resource will pointer the end resource now */
        resource->type = ACPI_RESOURCE_TYPE_END_TAG;
+       resource->length = sizeof(struct acpi_resource);
 
        return 0;
 }