diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-04-29 22:05:21 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-06 18:55:01 -0400 |
commit | d63f37901e0977857dc19764c0ada1768ce4415d (patch) | |
tree | c733dae937efbf4c1b77bb9c7d46ea96c9bf871c /tools/power/acpi | |
parent | 42873a84a22f6ee089b720c817bb61aebeff6e0d (diff) |
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>
Diffstat (limited to 'tools/power/acpi')
-rw-r--r-- | tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index dc6509884c25..a8cd344d621b 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | |||
@@ -996,10 +996,21 @@ osl_map_table(acpi_size address, | |||
996 | 996 | ||
997 | /* If specified, signature must match */ | 997 | /* If specified, signature must match */ |
998 | 998 | ||
999 | if (signature && !ACPI_COMPARE_NAME(signature, mapped_table->signature)) { | 999 | if (signature) { |
1000 | acpi_os_unmap_memory(mapped_table, | 1000 | if (ACPI_VALIDATE_RSDP_SIG(signature)) { |
1001 | sizeof(struct acpi_table_header)); | 1001 | if (!ACPI_VALIDATE_RSDP_SIG(mapped_table->signature)) { |
1002 | return (AE_BAD_SIGNATURE); | 1002 | acpi_os_unmap_memory(mapped_table, |
1003 | sizeof(struct | ||
1004 | acpi_table_header)); | ||
1005 | return (AE_BAD_SIGNATURE); | ||
1006 | } | ||
1007 | } else | ||
1008 | if (!ACPI_COMPARE_NAME(signature, mapped_table->signature)) | ||
1009 | { | ||
1010 | acpi_os_unmap_memory(mapped_table, | ||
1011 | sizeof(struct acpi_table_header)); | ||
1012 | return (AE_BAD_SIGNATURE); | ||
1013 | } | ||
1003 | } | 1014 | } |
1004 | 1015 | ||
1005 | /* Map the entire table */ | 1016 | /* Map the entire table */ |
@@ -1135,12 +1146,22 @@ osl_read_table_from_file(char *filename, | |||
1135 | 1146 | ||
1136 | /* If signature is specified, it must match the table */ | 1147 | /* If signature is specified, it must match the table */ |
1137 | 1148 | ||
1138 | if (signature && !ACPI_COMPARE_NAME(signature, header.signature)) { | 1149 | if (signature) { |
1139 | fprintf(stderr, | 1150 | if (ACPI_VALIDATE_RSDP_SIG(signature)) { |
1140 | "Incorrect signature: Expecting %4.4s, found %4.4s\n", | 1151 | if (!ACPI_VALIDATE_RSDP_SIG(header.signature)) { |
1141 | signature, header.signature); | 1152 | fprintf(stderr, |
1142 | status = AE_BAD_SIGNATURE; | 1153 | "Incorrect RSDP signature: found %8.8s\n", |
1143 | goto exit; | 1154 | header.signature); |
1155 | status = AE_BAD_SIGNATURE; | ||
1156 | goto exit; | ||
1157 | } | ||
1158 | } else if (!ACPI_COMPARE_NAME(signature, header.signature)) { | ||
1159 | fprintf(stderr, | ||
1160 | "Incorrect signature: Expecting %4.4s, found %4.4s\n", | ||
1161 | signature, header.signature); | ||
1162 | status = AE_BAD_SIGNATURE; | ||
1163 | goto exit; | ||
1164 | } | ||
1144 | } | 1165 | } |
1145 | 1166 | ||
1146 | table_length = ap_get_table_length(&header); | 1167 | table_length = ap_get_table_length(&header); |