summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. Box <david.e.box@linux.intel.com>2014-07-08 10:05:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-17 09:03:59 -0700
commitb3e98f0c4f996cd53b80bad71f0d7e4a2cf3a4e8 (patch)
tree821752bc123ea403a93e92a6433f6802082e75f4
parentdb065663add6a78c8054b11e41c30cd045316437 (diff)
downloadlinux-3.10-b3e98f0c4f996cd53b80bad71f0d7e4a2cf3a4e8.tar.gz
linux-3.10-b3e98f0c4f996cd53b80bad71f0d7e4a2cf3a4e8.tar.bz2
linux-3.10-b3e98f0c4f996cd53b80bad71f0d7e4a2cf3a4e8.zip
ACPICA: Utilities: Fix memory leak in acpi_ut_copy_iobject_to_iobject
commit 8aa5e56eeb61a099ea6519eb30ee399e1bc043ce upstream. Adds return status check on copy routines to delete the allocated destination object if either copy fails. Reported by Colin Ian King on bugs.acpica.org, Bug 1087. The last applicable commit: Commit: 3371c19c294a4cb3649aa4e84606be8a1d999e61 Subject: ACPICA: Remove ACPI_GET_OBJECT_TYPE macro Link: https://bugs.acpica.org/show_bug.cgi?id=1087 Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/acpi/acpica/utcopy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index e4c9291fc0a..a63a4cdd2ce 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -998,5 +998,11 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
}
+ /* Delete the allocated object if copy failed */
+
+ if (ACPI_FAILURE(status)) {
+ acpi_ut_remove_reference(*dest_desc);
+ }
+
return_ACPI_STATUS(status);
}