From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nicholas A. Bellinger" Subject: [PATCH] tcm_vhost: Fix tv_cmd completion -> release SGL memory leak Date: Thu, 5 Jul 2012 04:14:23 +0000 Message-ID: <1341461663-13434-1-git-send-email-nab@linux-iscsi.org> Cc: linux-scsi , lf-virt , kvm-devel , Stefan Hajnoczi , Zhi Yong Wu , Paolo Bonzini , "Michael S. Tsirkin" , Nicholas Bellinger To: target-devel Return-path: Sender: target-devel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org From: Nicholas Bellinger 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 Cc: Zhi Yong Wu Cc: Michael S. Tsirkin Signed-off-by: Nicholas Bellinger --- 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); -- 1.7.2.5