vhost/scsi: call vhost_dev_cleanup() at unrealize() time
PATCH 1/1 vhost/scsi: call vhost_dev_cleanup() at unrealize() time
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.
--- hw/scsi/vhost-scsi.c | 1 + 1 file changed, 1 insertion(+)
hw/scsi/vhost-scsi.c +1 -0
@@ -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);
Signature · 1 line
1.8.3.1
Paolo Bonzini
AppliedQuoted 20 lines · Igor Mammedov
vhost-scsi calls
vhost_dev_init()atrealize()time but forgets to call it's counterpartvhost_dev_cleanup()atunrealize()time.Calling it should fix leaking of memory table and
mem_sectionstable in vhost device. And also unregister vhost's memory listerner to prevent access from memory core to freed memory.Signed-off-by Igor Mammedov <[email protected]>--- hw/scsi/vhost-scsi.c | 1 + 1 file changed, 1 insertion(+)hw/scsi/vhost-scsi.c +0
-0
hw/scsi/vhost-scsi.c static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) · line 283
Quoted 7 lines
hw/scsi/vhost-scsi.c +1
-0@@ -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);
Applied to scsi-next, thanks.
Paolo