* [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
@ 2011-01-16 19:37 Jesper Juhl
2011-01-16 19:48 ` Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jesper Juhl @ 2011-01-16 19:37 UTC (permalink / raw)
To: linux-acpi; +Cc: linux-kernel, Len Brown, Lin Ming
We will leak the memory allocated to 'local_gpe_event_info' if
'acpi_ut_acquire_mutex()' fails or if 'acpi_ev_valid_gpe_event()' fails in
drivers/acpi/acpica/evgpe.c::acpi_ev_asynch_execute_gpe_method().
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
evgpe.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 7c339d3..b6de1fb 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -471,6 +471,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
+ ACPI_FREE(local_gpe_event_info);
return_VOID;
}
@@ -478,6 +479,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+ ACPI_FREE(local_gpe_event_info);
return_VOID;
}
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-16 19:37 [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method() Jesper Juhl
@ 2011-01-16 19:48 ` Rafael J. Wysocki
2011-01-16 19:51 ` Jesper Juhl
2011-01-17 1:47 ` Lin Ming
2011-01-17 4:20 ` Len Brown
2 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2011-01-16 19:48 UTC (permalink / raw)
To: Jesper Juhl, Len Brown; +Cc: linux-acpi, linux-kernel, Lin Ming
On Sunday, January 16, 2011, Jesper Juhl wrote:
> We will leak the memory allocated to 'local_gpe_event_info' if
> 'acpi_ut_acquire_mutex()' fails or if 'acpi_ev_valid_gpe_event()' fails in
> drivers/acpi/acpica/evgpe.c::acpi_ev_asynch_execute_gpe_method().
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Good catch! How did you find it?
Reviewed-by: Rafael Wysocki <rjw@sisk.pl>
Len, please apply and push to Linus ASAP.
Thanks,
Rafael
> ---
> evgpe.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
> index 7c339d3..b6de1fb 100644
> --- a/drivers/acpi/acpica/evgpe.c
> +++ b/drivers/acpi/acpica/evgpe.c
> @@ -471,6 +471,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
>
> status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
> if (ACPI_FAILURE(status)) {
> + ACPI_FREE(local_gpe_event_info);
> return_VOID;
> }
>
> @@ -478,6 +479,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
>
> if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
> status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
> + ACPI_FREE(local_gpe_event_info);
> return_VOID;
> }
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-16 19:48 ` Rafael J. Wysocki
@ 2011-01-16 19:51 ` Jesper Juhl
0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2011-01-16 19:51 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, linux-kernel, Lin Ming
On Sun, 16 Jan 2011, Rafael J. Wysocki wrote:
> On Sunday, January 16, 2011, Jesper Juhl wrote:
> > We will leak the memory allocated to 'local_gpe_event_info' if
> > 'acpi_ut_acquire_mutex()' fails or if 'acpi_ev_valid_gpe_event()' fails in
> > drivers/acpi/acpica/evgpe.c::acpi_ev_asynch_execute_gpe_method().
> >
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
>
> Good catch! How did you find it?
>
This one was found with the help of Coverity prevent.
> Reviewed-by: Rafael Wysocki <rjw@sisk.pl>
>
> Len, please apply and push to Linus ASAP.
>
> Thanks,
> Rafael
>
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-16 19:37 [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method() Jesper Juhl
2011-01-16 19:48 ` Rafael J. Wysocki
@ 2011-01-17 1:47 ` Lin Ming
2011-01-17 4:20 ` Len Brown
2 siblings, 0 replies; 6+ messages in thread
From: Lin Ming @ 2011-01-17 1:47 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Len Brown
On Mon, 2011-01-17 at 03:37 +0800, Jesper Juhl wrote:
> We will leak the memory allocated to 'local_gpe_event_info' if
> 'acpi_ut_acquire_mutex()' fails or if 'acpi_ev_valid_gpe_event()' fails in
> drivers/acpi/acpica/evgpe.c::acpi_ev_asynch_execute_gpe_method().
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> evgpe.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
> index 7c339d3..b6de1fb 100644
> --- a/drivers/acpi/acpica/evgpe.c
> +++ b/drivers/acpi/acpica/evgpe.c
> @@ -471,6 +471,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
>
> status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
> if (ACPI_FAILURE(status)) {
> + ACPI_FREE(local_gpe_event_info);
> return_VOID;
> }
>
> @@ -478,6 +479,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
>
> if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
> status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
> + ACPI_FREE(local_gpe_event_info);
> return_VOID;
> }
>
>
Acked-by: Lin Ming <ming.m.lin@intel.com>
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-16 19:37 [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method() Jesper Juhl
2011-01-16 19:48 ` Rafael J. Wysocki
2011-01-17 1:47 ` Lin Ming
@ 2011-01-17 4:20 ` Len Brown
2011-01-17 18:32 ` Jesper Juhl
2 siblings, 1 reply; 6+ messages in thread
From: Len Brown @ 2011-01-17 4:20 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-acpi, linux-kernel, Lin Ming
Looks like this bug was added by
5a284cd75d635e3c5db0210dc9a9a44c6839f460
(ACPICA: Fix local variable mess in acpi_ev_asynch_execute_gpe_method).
The good news is that it is new in 2.6.38-merge
Also, I doubt that these error cases actually
occur in any significant frequency in practice.
Thanks for the find.
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-17 4:20 ` Len Brown
@ 2011-01-17 18:32 ` Jesper Juhl
0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2011-01-17 18:32 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, linux-kernel, Lin Ming
On Sun, 16 Jan 2011, Len Brown wrote:
> Looks like this bug was added by
> 5a284cd75d635e3c5db0210dc9a9a44c6839f460
> (ACPICA: Fix local variable mess in acpi_ev_asynch_execute_gpe_method).
>
> The good news is that it is new in 2.6.38-merge
> Also, I doubt that these error cases actually
> occur in any significant frequency in practice.
>
> Thanks for the find.
>
You're welcome. Can I assume that you'll merge it and push it up-stream
from here?
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-17 18:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-16 19:37 [PATCH] ACPI: Fix memory leak in acpi_ev_asynch_execute_gpe_method() Jesper Juhl
2011-01-16 19:48 ` Rafael J. Wysocki
2011-01-16 19:51 ` Jesper Juhl
2011-01-17 1:47 ` Lin Ming
2011-01-17 4:20 ` Len Brown
2011-01-17 18:32 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox