aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2011-11-29 20:35:05 -0500
committerLen Brown <len.brown@intel.com>2012-01-17 03:36:27 -0500
commitec4636669bf9c6ff157121ab42709650a9e0cc2a (patch)
tree41b10cf575dde3d9e83beae5b0511ac8d7531f31 /drivers
parent46dfb09c024a1a92ead63b40f6993dcb5eb7d153 (diff)
ACPICA: Do not abort table load on invalid space ID
Ignore an invalid space ID during a table load. Instead, detect it if a control method attempts access - then abort the method. http://www.acpica.org/bugzilla/show_bug.cgi?id=925 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/acinterp.h2
-rw-r--r--drivers/acpi/acpica/excreate.c23
-rw-r--r--drivers/acpi/acpica/exfldio.c16
-rw-r--r--drivers/acpi/acpica/exutils.c25
4 files changed, 54 insertions, 12 deletions
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 3731e1c34b83..4ee9058aba53 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
468 468
469void acpi_ex_integer_to_string(char *dest, u64 value); 469void acpi_ex_integer_to_string(char *dest, u64 value);
470 470
471u8 acpi_is_valid_space_id(u8 space_id);
472
471/* 473/*
472 * exregion - default op_region handlers 474 * exregion - default op_region handlers
473 */ 475 */
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 8a06dc523af7..c66562b4311b 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -267,7 +267,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
267 * 267 *
268 * PARAMETERS: aml_start - Pointer to the region declaration AML 268 * PARAMETERS: aml_start - Pointer to the region declaration AML
269 * aml_length - Max length of the declaration AML 269 * aml_length - Max length of the declaration AML
270 * region_space - space_iD for the region 270 * space_id - Address space ID for the region
271 * walk_state - Current state 271 * walk_state - Current state
272 * 272 *
273 * RETURN: Status 273 * RETURN: Status
@@ -279,7 +279,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
279acpi_status 279acpi_status
280acpi_ex_create_region(u8 * aml_start, 280acpi_ex_create_region(u8 * aml_start,
281 u32 aml_length, 281 u32 aml_length,
282 u8 region_space, struct acpi_walk_state *walk_state) 282 u8 space_id, struct acpi_walk_state *walk_state)
283{ 283{
284 acpi_status status; 284 acpi_status status;
285 union acpi_operand_object *obj_desc; 285 union acpi_operand_object *obj_desc;
@@ -304,16 +304,19 @@ acpi_ex_create_region(u8 * aml_start,
304 * Space ID must be one of the predefined IDs, or in the user-defined 304 * Space ID must be one of the predefined IDs, or in the user-defined
305 * range 305 * range
306 */ 306 */
307 if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && 307 if (!acpi_is_valid_space_id(space_id)) {
308 (region_space < ACPI_USER_REGION_BEGIN) && 308 /*
309 (region_space != ACPI_ADR_SPACE_DATA_TABLE)) { 309 * Print an error message, but continue. We don't want to abort
310 ACPI_ERROR((AE_INFO, "Invalid AddressSpace type 0x%X", 310 * a table load for this exception. Instead, if the region is
311 region_space)); 311 * actually used at runtime, abort the executing method.
312 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); 312 */
313 ACPI_ERROR((AE_INFO,
314 "Invalid/unknown Address Space ID: 0x%2.2X",
315 space_id));
313 } 316 }
314 317
315 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n", 318 ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
316 acpi_ut_get_region_name(region_space), region_space)); 319 acpi_ut_get_region_name(space_id), space_id));
317 320
318 /* Create the region descriptor */ 321 /* Create the region descriptor */
319 322
@@ -339,7 +342,7 @@ acpi_ex_create_region(u8 * aml_start,
339 342
340 /* Init the region from the operands */ 343 /* Init the region from the operands */
341 344
342 obj_desc->region.space_id = region_space; 345 obj_desc->region.space_id = space_id;
343 obj_desc->region.address = 0; 346 obj_desc->region.address = 0;
344 obj_desc->region.length = 0; 347 obj_desc->region.length = 0;
345 obj_desc->region.node = node; 348 obj_desc->region.node = node;
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index 19df8ce66ee7..2a524fc1e851 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -86,6 +86,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
86{ 86{
87 acpi_status status = AE_OK; 87 acpi_status status = AE_OK;
88 union acpi_operand_object *rgn_desc; 88 union acpi_operand_object *rgn_desc;
89 u8 space_id;
89 90
90 ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); 91 ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset);
91 92
@@ -101,6 +102,17 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
101 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 102 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
102 } 103 }
103 104
105 space_id = rgn_desc->region.space_id;
106
107 /* Validate the Space ID */
108
109 if (!acpi_is_valid_space_id(space_id)) {
110 ACPI_ERROR((AE_INFO,
111 "Invalid/unknown Address Space ID: 0x%2.2X",
112 space_id));
113 return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
114 }
115
104 /* 116 /*
105 * If the Region Address and Length have not been previously evaluated, 117 * If the Region Address and Length have not been previously evaluated,
106 * evaluate them now and save the results. 118 * evaluate them now and save the results.
@@ -122,8 +134,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
122 * Exit now for SMBus or IPMI address space, it has a non-linear 134 * Exit now for SMBus or IPMI address space, it has a non-linear
123 * address space and the request cannot be directly validated 135 * address space and the request cannot be directly validated
124 */ 136 */
125 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || 137 if (space_id == ACPI_ADR_SPACE_SMBUS ||
126 rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { 138 space_id == ACPI_ADR_SPACE_IPMI) {
127 139
128 /* SMBus or IPMI has a non-linear address space */ 140 /* SMBus or IPMI has a non-linear address space */
129 141
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 8ad93146dd32..3993aa5084b6 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -435,4 +435,29 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
435 } 435 }
436} 436}
437 437
438/*******************************************************************************
439 *
440 * FUNCTION: acpi_is_valid_space_id
441 *
442 * PARAMETERS: space_id - ID to be validated
443 *
444 * RETURN: TRUE if valid/supported ID.
445 *
446 * DESCRIPTION: Validate an operation region space_iD.
447 *
448 ******************************************************************************/
449
450u8 acpi_is_valid_space_id(u8 space_id)
451{
452
453 if ((space_id >= ACPI_NUM_PREDEFINED_REGIONS) &&
454 (space_id < ACPI_USER_REGION_BEGIN) &&
455 (space_id != ACPI_ADR_SPACE_DATA_TABLE) &&
456 (space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) {
457 return (FALSE);
458 }
459
460 return (TRUE);
461}
462
438#endif 463#endif