All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: acpi_pad: Fix memory leak in power saving threads
@ 2018-03-27 13:56 Lenny Szubowicz
  2018-03-30 10:08 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Lenny Szubowicz @ 2018-03-27 13:56 UTC (permalink / raw)
  To: rjw, lenb, linux-acpi, linux-kernel

Fix once per second (round_robin_time) memory leak of about 1 KB in
each acpi_pad kernel idling thread that is activated.

Found by testing with kmemleak.

Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
---
 drivers/acpi/acpi_pad.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 7544310..552c1f7 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -110,6 +110,7 @@ static void round_robin_cpu(unsigned int tsk_index)
 		cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
 	if (cpumask_empty(tmp)) {
 		mutex_unlock(&round_robin_lock);
+		free_cpumask_var(tmp);
 		return;
 	}
 	for_each_cpu(cpu, tmp) {
@@ -127,6 +128,8 @@ static void round_robin_cpu(unsigned int tsk_index)
 	mutex_unlock(&round_robin_lock);
 
 	set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
+
+	free_cpumask_var(tmp);
 }
 
 static void exit_round_robin(unsigned int tsk_index)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ACPI: acpi_pad: Fix memory leak in power saving threads
  2018-03-27 13:56 [PATCH] ACPI: acpi_pad: Fix memory leak in power saving threads Lenny Szubowicz
@ 2018-03-30 10:08 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2018-03-30 10:08 UTC (permalink / raw)
  To: Lenny Szubowicz; +Cc: lenb, linux-acpi, linux-kernel

On Tuesday, March 27, 2018 3:56:40 PM CEST Lenny Szubowicz wrote:
> Fix once per second (round_robin_time) memory leak of about 1 KB in
> each acpi_pad kernel idling thread that is activated.
> 
> Found by testing with kmemleak.
> 
> Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
> ---
>  drivers/acpi/acpi_pad.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
> index 7544310..552c1f7 100644
> --- a/drivers/acpi/acpi_pad.c
> +++ b/drivers/acpi/acpi_pad.c
> @@ -110,6 +110,7 @@ static void round_robin_cpu(unsigned int tsk_index)
>  		cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
>  	if (cpumask_empty(tmp)) {
>  		mutex_unlock(&round_robin_lock);
> +		free_cpumask_var(tmp);
>  		return;
>  	}
>  	for_each_cpu(cpu, tmp) {
> @@ -127,6 +128,8 @@ static void round_robin_cpu(unsigned int tsk_index)
>  	mutex_unlock(&round_robin_lock);
>  
>  	set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
> +
> +	free_cpumask_var(tmp);
>  }
>  
>  static void exit_round_robin(unsigned int tsk_index)
> 

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-30 10:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 13:56 [PATCH] ACPI: acpi_pad: Fix memory leak in power saving threads Lenny Szubowicz
2018-03-30 10:08 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.