qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vhost/scsi: call vhost_dev_cleanup() at unrealize() time
@ 2015-07-30 13:29 Igor Mammedov
  2015-07-30 13:51 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2015-07-30 13:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: lina.lulina, pbonzini, arei.gonglei, mst

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>
---
 hw/scsi/vhost-scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index a69918b..0dd57ff 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -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);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost/scsi: call vhost_dev_cleanup() at unrealize() time
  2015-07-30 13:29 [Qemu-devel] [PATCH] vhost/scsi: call vhost_dev_cleanup() at unrealize() time Igor Mammedov
@ 2015-07-30 13:51 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2015-07-30 13:51 UTC (permalink / raw)
  To: Igor Mammedov, qemu-devel; +Cc: lina.lulina, arei.gonglei, mst



On 30/07/2015 15:29, Igor Mammedov wrote:
> 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>
> ---
>  hw/scsi/vhost-scsi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index a69918b..0dd57ff 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-30 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-30 13:29 [Qemu-devel] [PATCH] vhost/scsi: call vhost_dev_cleanup() at unrealize() time Igor Mammedov
2015-07-30 13:51 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).