public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Jenkins <darrenrjenkins@gmail.com>
To: djwong@us.ibm.com, lenb@kernel.org, linux-acpi@vger.kernel.org,
	Kernel Janitors <kernel-janitors@vger.kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] drivers/acpi/power_meter.c : remove double kfree()
Date: Tue, 12 Jan 2010 23:37:07 +1100	[thread overview]
Message-ID: <1263299827.4571.11.camel@ICE-BOX> (raw)

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;
 }



             reply	other threads:[~2010-01-12 12:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 12:37 Darren Jenkins [this message]
2010-01-13 19:29 ` [PATCH] drivers/acpi/power_meter.c : remove double kfree() Darrick J. Wong
2010-01-20  4:56   ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263299827.4571.11.camel@ICE-BOX \
    --to=darrenrjenkins@gmail.com \
    --cc=djwong@us.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox