ACPICA: acpidump: Fix truncated RSDP signature validation.
This patch enforces a rule to always use ACPI_VALIDATE_RSDP_SIG for RSDP signatures passed from table header or ACPI_SIG_RSDP so that truncated string comparison can be avoided. This could help to fix the issue that "RSD " matches but "RSD PTR " doesn't match. Lv Zheng. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
42873a84a2
commit
d63f37901e
@ -996,11 +996,22 @@ osl_map_table(acpi_size address,
|
|||||||
|
|
||||||
/* If specified, signature must match */
|
/* If specified, signature must match */
|
||||||
|
|
||||||
if (signature && !ACPI_COMPARE_NAME(signature, mapped_table->signature)) {
|
if (signature) {
|
||||||
|
if (ACPI_VALIDATE_RSDP_SIG(signature)) {
|
||||||
|
if (!ACPI_VALIDATE_RSDP_SIG(mapped_table->signature)) {
|
||||||
|
acpi_os_unmap_memory(mapped_table,
|
||||||
|
sizeof(struct
|
||||||
|
acpi_table_header));
|
||||||
|
return (AE_BAD_SIGNATURE);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (!ACPI_COMPARE_NAME(signature, mapped_table->signature))
|
||||||
|
{
|
||||||
acpi_os_unmap_memory(mapped_table,
|
acpi_os_unmap_memory(mapped_table,
|
||||||
sizeof(struct acpi_table_header));
|
sizeof(struct acpi_table_header));
|
||||||
return (AE_BAD_SIGNATURE);
|
return (AE_BAD_SIGNATURE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Map the entire table */
|
/* Map the entire table */
|
||||||
|
|
||||||
@ -1135,13 +1146,23 @@ osl_read_table_from_file(char *filename,
|
|||||||
|
|
||||||
/* If signature is specified, it must match the table */
|
/* If signature is specified, it must match the table */
|
||||||
|
|
||||||
if (signature && !ACPI_COMPARE_NAME(signature, header.signature)) {
|
if (signature) {
|
||||||
|
if (ACPI_VALIDATE_RSDP_SIG(signature)) {
|
||||||
|
if (!ACPI_VALIDATE_RSDP_SIG(header.signature)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Incorrect RSDP signature: found %8.8s\n",
|
||||||
|
header.signature);
|
||||||
|
status = AE_BAD_SIGNATURE;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
} else if (!ACPI_COMPARE_NAME(signature, header.signature)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Incorrect signature: Expecting %4.4s, found %4.4s\n",
|
"Incorrect signature: Expecting %4.4s, found %4.4s\n",
|
||||||
signature, header.signature);
|
signature, header.signature);
|
||||||
status = AE_BAD_SIGNATURE;
|
status = AE_BAD_SIGNATURE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
table_length = ap_get_table_length(&header);
|
table_length = ap_get_table_length(&header);
|
||||||
if (table_length == 0) {
|
if (table_length == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user