Skip to content

Commit

Permalink
virtio: make del_vqs idempotent
Browse files Browse the repository at this point in the history
Our code calls del_vqs multiple times, assuming
it's idempotent.

commit 3ec7a77
    virtio_pci: free up vq->priv
broke this assumption, by adding kfree there,
so multiple calls cause double free.

Fix it up.

Fixes: 3ec7a77
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Jan 6, 2015
1 parent b1940cd commit 80e9541
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/virtio/virtio_pci_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ void vp_del_vqs(struct virtio_device *vdev)

vp_free_vectors(vdev);
kfree(vp_dev->vqs);
vp_dev->vqs = NULL;
}

static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
Expand Down

0 comments on commit 80e9541

Please sign in to comment.