From patchwork Tue Jul 21 15:59:25 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: 36558 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 n6LG0cFs004220 for ; Tue, 21 Jul 2009 16:00:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752961AbZGUQAa (ORCPT ); Tue, 21 Jul 2009 12:00:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755364AbZGUQA3 (ORCPT ); Tue, 21 Jul 2009 12:00:29 -0400 Received: from mx2.redhat.com ([66.187.237.31]:59828 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752961AbZGUQA3 (ORCPT ); Tue, 21 Jul 2009 12:00:29 -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 n6LG0Pbv023358; Tue, 21 Jul 2009 12:00:25 -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 n6LG0NiD012660; Tue, 21 Jul 2009 12:00:23 -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 n6LG0I7O007681; Tue, 21 Jul 2009 12:00:19 -0400 Date: Tue, 21 Jul 2009 18:59:25 +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 Subject: [PATCH 2/2] virtio: fix double free_irq Message-ID: <20090721155925.GC3306@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 Decrement used vectors counter when removing the vq so that vp_free_vectors does not try to free the vector again. Signed-off-by: Michael S. Tsirkin --- drivers/virtio/virtio_pci.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index dab3c86..9dcc368 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -466,8 +466,10 @@ static void vp_del_vq(struct virtqueue *vq) iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); - if (info->vector != VIRTIO_MSI_NO_VECTOR) + if (info->vector != VIRTIO_MSI_NO_VECTOR) { free_irq(vp_dev->msix_entries[info->vector].vector, vq); + --vp_dev->msix_used_vectors; + } if (vp_dev->msix_enabled) { iowrite16(VIRTIO_MSI_NO_VECTOR,