* [PATCH 3.7-rc8] ACPICA: Fix ACPI mutex object allocation memory leak on error
@ 2012-12-05 17:38 Tim Gardner
2012-12-05 17:58 ` Moore, Robert
0 siblings, 1 reply; 2+ messages in thread
From: Tim Gardner @ 2012-12-05 17:38 UTC (permalink / raw)
To: linux-kernel
Cc: Tim Gardner, Len Brown, Rafael J. Wysocki, Lin Ming, Bob Moore,
linux-acpi
An unattached mutex object is not released
on error, thereby orphaning memory.
I stumbled on this when looking at the output of smatch:
drivers/acpi/acpica/dsmethod.c:225 acpi_ds_begin_method_execution() error: we previously assumed 'obj_desc->method.mutex' could be null (see line 209)
which led me to have a look at acpi_ds_create_method_mutex().
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Bob Moore <robert.moore@intel.com>
Cc: linux-acpi@vger.kernel.org
Cc: stable@vger.kernel.org #2.6.29+
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
This applied to the original version of dsmethod.c which was introduced
in 95b482a8d31116f3f5c2a5089569393234d06385 (2.6.29).
drivers/acpi/acpica/dsmethod.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index aa9a5d4..fe89ea9 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -151,6 +151,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
if (ACPI_FAILURE(status)) {
+ acpi_ut_delete_object_desc(mutex_desc);
return_ACPI_STATUS(status);
}
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH 3.7-rc8] ACPICA: Fix ACPI mutex object allocation memory leak on error
2012-12-05 17:38 [PATCH 3.7-rc8] ACPICA: Fix ACPI mutex object allocation memory leak on error Tim Gardner
@ 2012-12-05 17:58 ` Moore, Robert
0 siblings, 0 replies; 2+ messages in thread
From: Moore, Robert @ 2012-12-05 17:58 UTC (permalink / raw)
To: Tim Gardner, linux-kernel
Cc: Len Brown, Rafael J. Wysocki, Lin Ming, linux-acpi
Tim,
Thanks. We will need to backport this change to the ACPICA source code.
Bob
> -----Original Message-----
> From: Tim Gardner [mailto:tim.gardner@canonical.com]
> Sent: Wednesday, December 05, 2012 9:39 AM
> To: linux-kernel@vger.kernel.org
> Cc: Tim Gardner; Len Brown; Rafael J. Wysocki; Lin Ming; Moore, Robert;
> linux-acpi@vger.kernel.org
> Subject: [PATCH 3.7-rc8] ACPICA: Fix ACPI mutex object allocation memory
> leak on error
>
> An unattached mutex object is not released on error, thereby orphaning
> memory.
>
> I stumbled on this when looking at the output of smatch:
>
> drivers/acpi/acpica/dsmethod.c:225 acpi_ds_begin_method_execution() error:
> we previously assumed 'obj_desc->method.mutex' could be null (see line
> 209)
>
> which led me to have a look at acpi_ds_create_method_mutex().
>
> Cc: Len Brown <lenb@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: Lin Ming <ming.m.lin@intel.com>
> Cc: Bob Moore <robert.moore@intel.com>
> Cc: linux-acpi@vger.kernel.org
> Cc: stable@vger.kernel.org #2.6.29+
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>
> This applied to the original version of dsmethod.c which was introduced in
> 95b482a8d31116f3f5c2a5089569393234d06385 (2.6.29).
>
> drivers/acpi/acpica/dsmethod.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/acpica/dsmethod.c
> b/drivers/acpi/acpica/dsmethod.c index aa9a5d4..fe89ea9 100644
> --- a/drivers/acpi/acpica/dsmethod.c
> +++ b/drivers/acpi/acpica/dsmethod.c
> @@ -151,6 +151,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object
> *method_desc)
>
> status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
> if (ACPI_FAILURE(status)) {
> + acpi_ut_delete_object_desc(mutex_desc);
> return_ACPI_STATUS(status);
> }
>
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-05 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-05 17:38 [PATCH 3.7-rc8] ACPICA: Fix ACPI mutex object allocation memory leak on error Tim Gardner
2012-12-05 17:58 ` Moore, Robert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®