public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/acpi/power_meter.c : remove double kfree()
@ 2010-01-12 12:37 Darren Jenkins
  2010-01-13 19:29 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Darren Jenkins @ 2010-01-12 12:37 UTC (permalink / raw)
  To: djwong, lenb, linux-acpi, Kernel Janitors; +Cc: Linux Kernel Mailing List

resource->domain_devices can be double kfree()'d in a couple of places.
Fix this by setting num_domain_devices = 0 after the kfree().

Coverity CID: 13356, 13355, 13354

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com> 

diff --git drivers/acpi/power_meter.c drivers/acpi/power_meter.c
index 2ef7030..18ce00a 100644
--- drivers/acpi/power_meter.c
+++ drivers/acpi/power_meter.c
@@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource)
 
 	kfree(resource->domain_devices);
 	kobject_put(resource->holders_dir);
+	resource->num_domain_devices = 0;
 }
 
 static int read_domain_devices(struct acpi_power_meter_resource *resource)
@@ -740,7 +741,6 @@ skip_unsafe_cap:
 
 	return res;
 error:
-	remove_domain_devices(resource);
 	remove_attrs(resource);
 	return res;
 }



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

* Re: [PATCH] drivers/acpi/power_meter.c : remove double kfree()
  2010-01-12 12:37 [PATCH] drivers/acpi/power_meter.c : remove double kfree() Darren Jenkins
@ 2010-01-13 19:29 ` Darrick J. Wong
  2010-01-20  4:56   ` Len Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2010-01-13 19:29 UTC (permalink / raw)
  To: Darren Jenkins
  Cc: lenb, linux-acpi, Kernel Janitors, Linux Kernel Mailing List

On Tue, Jan 12, 2010 at 11:37:07PM +1100, Darren Jenkins wrote:
> resource->domain_devices can be double kfree()'d in a couple of places.
> Fix this by setting num_domain_devices = 0 after the kfree().
> 
> Coverity CID: 13356, 13355, 13354
> 
> Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com> 

Thanks for catching this.

Acked-by: Darrick J. Wong <djwong@us.ibm.com>

> 
> diff --git drivers/acpi/power_meter.c drivers/acpi/power_meter.c
> index 2ef7030..18ce00a 100644
> --- drivers/acpi/power_meter.c
> +++ drivers/acpi/power_meter.c
> @@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource)
> 
>  	kfree(resource->domain_devices);
>  	kobject_put(resource->holders_dir);
> +	resource->num_domain_devices = 0;
>  }
> 
>  static int read_domain_devices(struct acpi_power_meter_resource *resource)
> @@ -740,7 +741,6 @@ skip_unsafe_cap:
> 
>  	return res;
>  error:
> -	remove_domain_devices(resource);
>  	remove_attrs(resource);
>  	return res;
>  }
> 
> 

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

* Re: [PATCH] drivers/acpi/power_meter.c : remove double kfree()
  2010-01-13 19:29 ` Darrick J. Wong
@ 2010-01-20  4:56   ` Len Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Len Brown @ 2010-01-20  4:56 UTC (permalink / raw)
  To: Darrick J. Wong
  Cc: Darren Jenkins, linux-acpi, Kernel Janitors,
	Linux Kernel Mailing List

applied

thanks,
Len Brown, Intel Open Source Technology Center


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

end of thread, other threads:[~2010-01-20  4:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 12:37 [PATCH] drivers/acpi/power_meter.c : remove double kfree() Darren Jenkins
2010-01-13 19:29 ` Darrick J. Wong
2010-01-20  4:56   ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox