aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2009-08-12 22:43:27 -0400
committerLen Brown <len.brown@intel.com>2009-08-27 13:10:35 -0400
commita5fe1a03f7720b8da8364a1737e1e5a357904e99 (patch)
tree2b84668217bc55d8a3bb98d053e92ff93b34dd36 /drivers/acpi/acpica
parent422bef879e84104fee6dc68ded0e371dbeb5f88e (diff)
ACPICA: fix leak of acpi_os_validate_address
http://bugzilla.kernel.org/show_bug.cgi?id=13620 If the dynamic region is created and added to resource list over and over again, it has the potential to be a memory leak by growing the list every time. This patch fixes the memory leak, as below 1) add a new field "count" to struct acpi_res_list. When inserting, if the region(addr, len) is already in the resource list, we just increase "count", otherwise, the region is inserted with count=1. When deleting, the "count" is decreased, if it's decreased to 0, the region is deleted from the resource list. With "count", the region with same address and length can only be inserted to the resource list once, so prevent potential memory leak. 2) add a new function acpi_os_invalidate_address, which is called when region is deleted. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/utdelete.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index bc1710315088..96e26e70c63d 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -215,6 +215,12 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
215 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 215 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
216 "***** Region %p\n", object)); 216 "***** Region %p\n", object));
217 217
218 /* Invalidate the region address/length via the host OS */
219
220 acpi_os_invalidate_address(object->region.space_id,
221 object->region.address,
222 (acpi_size) object->region.length);
223
218 second_desc = acpi_ns_get_secondary_object(object); 224 second_desc = acpi_ns_get_secondary_object(object);
219 if (second_desc) { 225 if (second_desc) {
220 /* 226 /*