Re: [PATCH] drivers/acpi/power_meter.c : remove double kfree()

From: Darrick J. Wong
Date: Wed Jan 13 2010 - 14:30:01 EST


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@xxxxxxxxx>

Thanks for catching this.

Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx>

>
> 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;
> }
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/