Skip to contentSkip to conversation

drivers/acpi/power_meter.c : remove double kfree()

PATCH Applied Darren Jenkins 3 participants 3 messages Jan 12, 2010 – Jan 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/acpi/power_meter.c : remove double kfree()

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

acpi/power_meter.c +1 -1
index 2ef7030..18ce00a 100644
@@ -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;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Darren Jenkins

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

Thanks for catching this.

Quoted 23 lines
acpi/power_meter.c +1 -1
index 2ef7030..18ce00a 100644
@@ -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;
 }
reviewer Applied
#2 lore raw

applied

thanks,
Len Brown, Intel Open Source Technology Center