Skip to content

Commit

Permalink
vhost/scsi: call vhost_dev_cleanup() at unrealize() time
Browse files Browse the repository at this point in the history
vhost-scsi calls vhost_dev_init() at realize() time
but forgets to call it's counterpart vhost_dev_cleanup()
at unrealize() time.

Calling it should fix leaking of memory table and
mem_sections table in vhost device. And also unregister
vhost's memory listerner to prevent access from
memory core to freed memory.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1438262999-287627-1-git-send-email-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Igor Mammedov authored and bonzini committed Jul 30, 2015
1 parent 975b665 commit af103c9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/scsi/vhost-scsi.c
Expand Up @@ -277,6 +277,7 @@ static void vhost_scsi_unrealize(DeviceState *dev, Error **errp)
/* This will stop vhost backend. */
vhost_scsi_set_status(vdev, 0);

vhost_dev_cleanup(&s->dev);
g_free(s->dev.vqs);

virtio_scsi_common_unrealize(dev, errp);
Expand Down

0 comments on commit af103c9

Please sign in to comment.