aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid E. Box <david.e.box@intel.com>2013-09-22 21:52:12 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-09-23 19:46:24 -0400
commitd2e7d079c7f21999e93802351c6ac7b31d266cce (patch)
tree538168357af90510c1135c5caa797ad8f67e9522
parenta2fd4b4b4e2884405c54a91514b0fad3853aea01 (diff)
ACPICA: Operation region support: Never free the handler "context" pointer.
This change removes some dangerous code that attempts to free the handler context pointer in some (rare) circumstances. The owner of the handler owns this pointer and the ACPICA code should never touch it. Although not seen to be an issue in any kernel, it did show up as a problem under AcpiExec. Also, set the internal storage field for the context pointer to zero when the region is deactivated, simply for sanity. David Box. Signed-off-by: David E. Box <david.e.box@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Reviewed-by: Len Brown <len.brown@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/evregion.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index cea14d6fc76c..6293d6bb6fe1 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -217,16 +217,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
217 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { 217 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
218 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; 218 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
219 219
220 if (region_obj2->extra.region_context) { 220 /*
221 221 * Save the returned context for use in all accesses to
222 /* The handler for this region was already installed */ 222 * the handler for this particular region
223 223 */
224 ACPI_FREE(region_context); 224 if (!(region_obj2->extra.region_context)) {
225 } else {
226 /*
227 * Save the returned context for use in all accesses to
228 * this particular region
229 */
230 region_obj2->extra.region_context = 225 region_obj2->extra.region_context =
231 region_context; 226 region_context;
232 } 227 }
@@ -402,6 +397,14 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
402 handler_obj->address_space. 397 handler_obj->address_space.
403 context, region_context); 398 context, region_context);
404 399
400 /*
401 * region_context should have been released by the deactivate
402 * operation. We don't need access to it anymore here.
403 */
404 if (region_context) {
405 *region_context = NULL;
406 }
407
405 /* Init routine may fail, Just ignore errors */ 408 /* Init routine may fail, Just ignore errors */
406 409
407 if (ACPI_FAILURE(status)) { 410 if (ACPI_FAILURE(status)) {