lkml.org 
[lkml]   [2011]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] staging/hv: Fix memory leak of storvsc_dev_add()
Date


> -----Original Message-----
> From: devel-bounces@linuxdriverproject.org [mailto:devel-
> bounces@linuxdriverproject.org] On Behalf Of Andre Bartke
> Sent: Tuesday, May 31, 2011 5:46 PM
> To: gregkh@suse.de
> Cc: devel@driverdev.osuosl.org; Andre Bartke; Haiyang Zhang; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] staging/hv: Fix memory leak of storvsc_dev_add()
>
> stor_device is not freed in storvsc_dev_add()
> causing a memory leak in case of an allocation error.
>
> Signed-off-by: Andre Bartke <andre.bartke@gmail.com>
> ---
> drivers/staging/hv/storvsc.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
> index 06cd327..92b44f4 100644
> --- a/drivers/staging/hv/storvsc.c
> +++ b/drivers/staging/hv/storvsc.c
> @@ -414,6 +414,7 @@ int storvsc_dev_add(struct hv_device *device,
> device_info->target_id = stor_device->target_id;
>
> cleanup:
> + free_stor_device(stor_device);
> return ret;

Was this patch tested? Even the normal path falls through the cleanup label
and obviously you should not be freeing the stor_device in that case. I have
patches queued up to cleanup some of the unnecessary labels and meaningless
return values that I will be sending soon.

Regards,

K. Y





\
 
 \ /
  Last update: 2011-06-01 14:31    [W:0.068 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site