All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: target-devel <target-devel@vger.kernel.org>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	kvm-devel <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Zhi Yong Wu <wuzhy@cn.ibm.com>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	lf-virt <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH] tcm_vhost: Fix tv_cmd completion -> release SGL memory leak
Date: Thu, 05 Jul 2012 13:24:16 +0800	[thread overview]
Message-ID: <1341465859.20287.66.camel@f15.cn.ibm.com> (raw)
In-Reply-To: <1341461663-13434-1-git-send-email-nab@linux-iscsi.org>

On Thu, 2012-07-05 at 04:14 +0000, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
> 
> The SGL memory allocated during vhost_scsi_map_iov_to_sgl() setup was never
> getting freed during tv_cmd completion -> release path.  Fix this up by releasing
> tv_cmd->tvc_sgl in vhost_scsi_free_cmd() ahead of tv_cmd descriptor free.
> 
> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
>  drivers/vhost/tcm_vhost.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
> index cd86633..9692153 100644
> --- a/drivers/vhost/tcm_vhost.c
> +++ b/drivers/vhost/tcm_vhost.c
> @@ -387,6 +387,8 @@ static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd)
>  		u32 i;
>  		for (i = 0; i < tv_cmd->tvc_sgl_count; i++)
>  			put_page(sg_page(&tv_cmd->tvc_sgl[i]));
> +
> +		kfree(tv_cmd->tvc_sgl);
>  	}
> 
>  	kfree(tv_cmd);

Reviewed-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

-- 
Regards,

Zhi Yong Wu


  reply	other threads:[~2012-07-05  5:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  4:14 [PATCH] tcm_vhost: Fix tv_cmd completion -> release SGL memory leak Nicholas A. Bellinger
2012-07-05  5:24 ` Zhi Yong Wu [this message]
2012-07-05  5:24 ` Zhi Yong Wu
  -- strict thread matches above, loose matches on Subject: below --
2012-07-05  4:14 Nicholas A. Bellinger

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=1341465859.20287.66.camel@f15.cn.ibm.com \
    --to=wuzhy@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wuzhy@cn.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.