From patchwork Tue Jul 21 15:59:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 36559 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6LG1ejw004380 for ; Tue, 21 Jul 2009 16:01:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754923AbZGUQBA (ORCPT ); Tue, 21 Jul 2009 12:01:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755246AbZGUQBA (ORCPT ); Tue, 21 Jul 2009 12:01:00 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59846 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754397AbZGUQBA (ORCPT ); Tue, 21 Jul 2009 12:01:00 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6LG09l5023314; Tue, 21 Jul 2009 12:00:09 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6LG07K7012546; Tue, 21 Jul 2009 12:00:08 -0400 Received: from redhat.com (vpn-10-22.str.redhat.com [10.32.10.22]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6LG01mY007286; Tue, 21 Jul 2009 12:00:03 -0400 Date: Tue, 21 Jul 2009 18:59:09 +0300 From: "Michael S. Tsirkin" To: Rusty Russell , Christian Borntraeger , virtualization@lists.linux-foundation.org, Anthony Liguori , kvm@vger.kernel.org, avi@redhat.com, Carsten Otte , t@redhat.com Subject: [PATCH 1/2] virtio: fix memory leak on device removal Message-ID: <20090721155909.GB3306@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Free up msi vector tables. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 193c8f0..dab3c86 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -489,12 +489,15 @@ static void vp_del_vq(struct virtqueue *vq) /* the config->del_vqs() implementation */ static void vp_del_vqs(struct virtio_device *vdev) { + struct virtio_pci_device *vp_dev = to_vp_device(vdev); struct virtqueue *vq, *n; list_for_each_entry_safe(vq, n, &vdev->vqs, list) vp_del_vq(vq); vp_free_vectors(vdev); + kfree(vp_dev->msix_names); + kfree(vp_dev->msix_entries); } /* the config->find_vqs() implementation */