Skip to content

Commit

Permalink
acpica: validate package element more carefully in acpi_rs_get_pci_ro…
Browse files Browse the repository at this point in the history
…uting_table_length

acpi_rs_get_pci_routing_table_length is not performing sufficient
validation on the package returned from _PRT.  It assumes a package of
packages and fails/faults if this is not the case.

We should validate each subpackage when extracted from the parent
package, and not accept objects of the wrong type, since that will just
cause the scanning to fail (likely with a kernel oops).

This can only happen with a serious BIOS bug, and is accompanied by a
warning something like this:

  ACPI Warning (nspredef-0949): \_SB_.PCI0.PEG4._PRT: Return Package type mismatch at index 0 - found Integer, expected Package [20090320]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Robert Moore authored and Linus Torvalds committed May 2, 2009
1 parent 091438d commit 53951bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/acpi/acpica/rscalc.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,13 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,

package_element = *top_object_list;

/* We must have a valid Package object */

if (!package_element ||
(package_element->common.type != ACPI_TYPE_PACKAGE)) {
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}

/*
* The sub_object_list will now point to an array of the
* four IRQ elements: Address, Pin, Source and source_index
Expand Down

0 comments on commit 53951bd

Please sign in to comment.