Commit f084dbb9 authored by Yinghai Lu's avatar Yinghai Lu Committed by Rafael J. Wysocki

ACPI: Set length even for TYPE_END_TAG acpi resource

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: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent eccc5343
...@@ -354,6 +354,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -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.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->end.length = sizeof(struct acpi_resource);
/* Attempt to set the resource */ /* Attempt to set the resource */
status = acpi_set_current_resources(link->device->handle, &buffer); status = acpi_set_current_resources(link->device->handle, &buffer);
......
...@@ -4121,7 +4121,7 @@ static int sony_pic_enable(struct acpi_device *device, ...@@ -4121,7 +4121,7 @@ static int sony_pic_enable(struct acpi_device *device,
resource->res3.data.irq.sharable = ACPI_SHARED; resource->res3.data.irq.sharable = ACPI_SHARED;
resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG; resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->res4.length = sizeof(struct acpi_resource);
} }
/* setup Type 2/3 resources */ /* setup Type 2/3 resources */
else { else {
...@@ -4140,6 +4140,7 @@ static int sony_pic_enable(struct acpi_device *device, ...@@ -4140,6 +4140,7 @@ static int sony_pic_enable(struct acpi_device *device,
resource->res2.data.irq.sharable = ACPI_SHARED; resource->res2.data.irq.sharable = ACPI_SHARED;
resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG; resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
resource->res3.length = sizeof(struct acpi_resource);
} }
/* Attempt to set the resource */ /* Attempt to set the resource */
......
...@@ -634,6 +634,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, ...@@ -634,6 +634,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
} }
/* resource will pointer the end resource now */ /* resource will pointer the end resource now */
resource->type = ACPI_RESOURCE_TYPE_END_TAG; resource->type = ACPI_RESOURCE_TYPE_END_TAG;
resource->length = sizeof(struct acpi_resource);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment