aboutsummaryrefslogtreecommitdiff
path: root/hw/block/virtio-blk.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-09-19 14:28:04 +0100
committerMichael S. Tsirkin <mst@redhat.com>2016-10-10 01:16:58 +0300
commit97b93c8ad2242c5a5f89ac50f9e696289c5b4947 (patch)
treeaf31ae74d3fa8cdbc39fe55abab6209fe5701d3a /hw/block/virtio-blk.c
parent2640d2a5ff08978d67bd87518d05d6b499488c9a (diff)
virtio-blk: add missing virtio_detach_element() call
Make sure to unmap the scatter-gather list and decrement vq->inuse before freeing requests in virtio_blk_reset(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/block/virtio-blk.c')
-rw-r--r--hw/block/virtio-blk.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 3a6112fbf4..c7ca4d6769 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -665,6 +665,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
while (s->rq) {
req = s->rq;
s->rq = req->next;
+ virtqueue_detach_element(req->vq, &req->elem, 0);
virtio_blk_free_request(req);
}