public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com
Subject: Re: [PATCH 1/1] Drivers: hv: balloon: Fix a memory leak
Date: Thu, 13 Dec 2012 13:21:46 +0800	[thread overview]
Message-ID: <50C965EA.80905@redhat.com> (raw)
In-Reply-To: <1355252837-9827-1-git-send-email-kys@microsoft.com>

On 12/12/2012 03:07 AM, K. Y. Srinivasan wrote:
> The send buffer was being leaked; fix it.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reported-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/hv/hv_balloon.c |   23 +++++++++++++----------
>  1 files changed, 13 insertions(+), 10 deletions(-)

Thanks.

Acked-by: Jason Wang <jasowang@redhat.com>
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 00c8447..c02a33e 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -882,7 +882,7 @@ static int balloon_probe(struct hv_device *dev,
>  			balloon_onchannelcallback, dev);
>  
>  	if (ret)
> -		return ret;
> +		goto probe_error0;
>  
>  	dm_device.dev = dev;
>  	dm_device.state = DM_INITIALIZING;
> @@ -894,7 +894,7 @@ static int balloon_probe(struct hv_device *dev,
>  		 kthread_run(dm_thread_func, &dm_device, "hv_balloon");
>  	if (IS_ERR(dm_device.thread)) {
>  		ret = PTR_ERR(dm_device.thread);
> -		goto probe_error0;
> +		goto probe_error1;
>  	}
>  
>  	hv_set_drvdata(dev, &dm_device);
> @@ -917,12 +917,12 @@ static int balloon_probe(struct hv_device *dev,
>  				VM_PKT_DATA_INBAND,
>  				VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
>  	if (ret)
> -		goto probe_error1;
> +		goto probe_error2;
>  
>  	t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
>  	if (t == 0) {
>  		ret = -ETIMEDOUT;
> -		goto probe_error1;
> +		goto probe_error2;
>  	}
>  
>  	/*
> @@ -931,7 +931,7 @@ static int balloon_probe(struct hv_device *dev,
>  	 */
>  	if (dm_device.state == DM_INIT_ERROR) {
>  		ret = -ETIMEDOUT;
> -		goto probe_error1;
> +		goto probe_error2;
>  	}
>  	/*
>  	 * Now submit our capabilities to the host.
> @@ -964,12 +964,12 @@ static int balloon_probe(struct hv_device *dev,
>  				VM_PKT_DATA_INBAND,
>  				VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
>  	if (ret)
> -		goto probe_error1;
> +		goto probe_error2;
>  
>  	t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
>  	if (t == 0) {
>  		ret = -ETIMEDOUT;
> -		goto probe_error1;
> +		goto probe_error2;
>  	}
>  
>  	/*
> @@ -978,18 +978,20 @@ static int balloon_probe(struct hv_device *dev,
>  	 */
>  	if (dm_device.state == DM_INIT_ERROR) {
>  		ret = -ETIMEDOUT;
> -		goto probe_error1;
> +		goto probe_error2;
>  	}
>  
>  	dm_device.state = DM_INITIALIZED;
>  
>  	return 0;
>  
> -probe_error1:
> +probe_error2:
>  	kthread_stop(dm_device.thread);
>  
> -probe_error0:
> +probe_error1:
>  	vmbus_close(dev->channel);
> +probe_error0:
> +	kfree(send_buffer);
>  	return ret;
>  }
>  
> @@ -1002,6 +1004,7 @@ static int balloon_remove(struct hv_device *dev)
>  
>  	vmbus_close(dev->channel);
>  	kthread_stop(dm->thread);
> +	kfree(send_buffer);
>  
>  	return 0;
>  }


  reply	other threads:[~2012-12-13  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 19:07 [PATCH 1/1] Drivers: hv: balloon: Fix a memory leak K. Y. Srinivasan
2012-12-13  5:21 ` Jason Wang [this message]
2012-12-13  9:37 ` Dan Carpenter
2012-12-13 15:29   ` KY Srinivasan

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=50C965EA.80905@redhat.com \
    --to=jasowang@redhat.com \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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