From patchwork Thu Jul 5 04:14:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 1157951 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 57D3C3FD4F for ; Thu, 5 Jul 2012 04:17:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751046Ab2GEEQ4 (ORCPT ); Thu, 5 Jul 2012 00:16:56 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:47916 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836Ab2GEEQz (ORCPT ); Thu, 5 Jul 2012 00:16:55 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id 23F8E22D9E3; Thu, 5 Jul 2012 04:14:30 +0000 (UTC) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lf-virt , kvm-devel , Stefan Hajnoczi , Zhi Yong Wu , Paolo Bonzini , "Michael S. Tsirkin" , Nicholas 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> X-Mailer: git-send-email 1.7.2.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: 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 Reviewed-by: Zhi Yong Wu --- 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);