qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] fix memleaks in virtio_9p_device_unrealize
@ 2020-01-17  6:09 pannengyuan
  2020-01-17  6:09 ` [PATCH v2 1/2] virtio-9p-device: fix memleak " pannengyuan
  2020-01-17  6:09 ` [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue pannengyuan
  0 siblings, 2 replies; 7+ messages in thread
From: pannengyuan @ 2020-01-17  6:09 UTC (permalink / raw)
  To: mst, groug; +Cc: Pan Nengyuan, qemu-devel, zhang.zhanghailiang

From: Pan Nengyuan <pannengyuan@huawei.com>

v1: fix memleaks in virtio_9p_device_unrealize
v2: split patch to make it easier for stable branches to merge

Pan Nengyuan (2):
  virtio-9p-device: fix memleak in virtio_9p_device_unrealize
  virtio-9p-device: convert to new virtio_delete_queue

 hw/9pfs/virtio-9p-device.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.21.0.windows.1




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

* [PATCH v2 1/2] virtio-9p-device: fix memleak in virtio_9p_device_unrealize
  2020-01-17  6:09 [PATCH v2 0/2] fix memleaks in virtio_9p_device_unrealize pannengyuan
@ 2020-01-17  6:09 ` pannengyuan
  2020-01-17 12:52   ` Christian Schoenebeck
  2020-01-17  6:09 ` [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue pannengyuan
  1 sibling, 1 reply; 7+ messages in thread
From: pannengyuan @ 2020-01-17  6:09 UTC (permalink / raw)
  To: mst, groug; +Cc: Euler Robot, Pan Nengyuan, qemu-devel, zhang.zhanghailiang

From: Pan Nengyuan <pannengyuan@huawei.com>

v->vq forgot to cleanup in virtio_9p_device_unrealize, the memory leak
stack is as follow:

Direct leak of 14336 byte(s) in 2 object(s) allocated from:
  #0 0x7f819ae43970 (/lib64/libasan.so.5+0xef970)  ??:?
  #1 0x7f819872f49d (/lib64/libglib-2.0.so.0+0x5249d)  ??:?
  #2 0x55a3a58da624 (./x86_64-softmmu/qemu-system-x86_64+0x2c14624)  /mnt/sdb/qemu/hw/virtio/virtio.c:2327
  #3 0x55a3a571bac7 (./x86_64-softmmu/qemu-system-x86_64+0x2a55ac7)  /mnt/sdb/qemu/hw/9pfs/virtio-9p-device.c:209
  #4 0x55a3a58e7bc6 (./x86_64-softmmu/qemu-system-x86_64+0x2c21bc6)  /mnt/sdb/qemu/hw/virtio/virtio.c:3504
  #5 0x55a3a5ebfb37 (./x86_64-softmmu/qemu-system-x86_64+0x31f9b37)  /mnt/sdb/qemu/hw/core/qdev.c:876

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Changes V2 to V1:
- use old function virtio_del_queue to make it easier for stable branch
to merge (suggested by Christian Schoenebeck)
---
 hw/9pfs/virtio-9p-device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index b5a7c03f26..910dc5045e 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -215,6 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp)
     V9fsVirtioState *v = VIRTIO_9P(dev);
     V9fsState *s = &v->state;
 
+    virtio_del_queue(vdev, 0);
     virtio_cleanup(vdev);
     v9fs_device_unrealize_common(s, errp);
 }
-- 
2.21.0.windows.1




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

* [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue
  2020-01-17  6:09 [PATCH v2 0/2] fix memleaks in virtio_9p_device_unrealize pannengyuan
  2020-01-17  6:09 ` [PATCH v2 1/2] virtio-9p-device: fix memleak " pannengyuan
@ 2020-01-17  6:09 ` pannengyuan
  2020-01-17 13:03   ` Christian Schoenebeck
  1 sibling, 1 reply; 7+ messages in thread
From: pannengyuan @ 2020-01-17  6:09 UTC (permalink / raw)
  To: mst, groug; +Cc: Pan Nengyuan, qemu-devel, zhang.zhanghailiang

From: Pan Nengyuan <pannengyuan@huawei.com>

Use virtio_delete_queue to make it more clear.

Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Changes V2 to V1:
- replace virtio_del_queue to virtio_delete_queue to make it more clear.
---
 hw/9pfs/virtio-9p-device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 910dc5045e..b146387ae2 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -215,7 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp)
     V9fsVirtioState *v = VIRTIO_9P(dev);
     V9fsState *s = &v->state;
 
-    virtio_del_queue(vdev, 0);
+    virtio_delete_queue(v->vq);
     virtio_cleanup(vdev);
     v9fs_device_unrealize_common(s, errp);
 }
-- 
2.21.0.windows.1




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

* Re: [PATCH v2 1/2] virtio-9p-device: fix memleak in virtio_9p_device_unrealize
  2020-01-17  6:09 ` [PATCH v2 1/2] virtio-9p-device: fix memleak " pannengyuan
@ 2020-01-17 12:52   ` Christian Schoenebeck
  2020-01-17 13:43     ` Michael S. Tsirkin
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Schoenebeck @ 2020-01-17 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: pannengyuan, mst, groug, Euler Robot, zhang.zhanghailiang

On Freitag, 17. Januar 2020 07:09:26 CET pannengyuan@huawei.com wrote:
> From: Pan Nengyuan <pannengyuan@huawei.com>
> 
> v->vq forgot to cleanup in virtio_9p_device_unrealize, the memory leak
> stack is as follow:
> 
> Direct leak of 14336 byte(s) in 2 object(s) allocated from:
>   #0 0x7f819ae43970 (/lib64/libasan.so.5+0xef970)  ??:?
>   #1 0x7f819872f49d (/lib64/libglib-2.0.so.0+0x5249d)  ??:?
>   #2 0x55a3a58da624 (./x86_64-softmmu/qemu-system-x86_64+0x2c14624) 
> /mnt/sdb/qemu/hw/virtio/virtio.c:2327 #3 0x55a3a571bac7
> (./x86_64-softmmu/qemu-system-x86_64+0x2a55ac7) 
> /mnt/sdb/qemu/hw/9pfs/virtio-9p-device.c:209 #4 0x55a3a58e7bc6
> (./x86_64-softmmu/qemu-system-x86_64+0x2c21bc6) 
> /mnt/sdb/qemu/hw/virtio/virtio.c:3504 #5 0x55a3a5ebfb37
> (./x86_64-softmmu/qemu-system-x86_64+0x31f9b37) 
> /mnt/sdb/qemu/hw/core/qdev.c:876
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>

Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

Maybe you could add this patch to your revised PR Greg?

> ---
> Changes V2 to V1:
> - use old function virtio_del_queue to make it easier for stable branch
> to merge (suggested by Christian Schoenebeck)
> ---
>  hw/9pfs/virtio-9p-device.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> index b5a7c03f26..910dc5045e 100644
> --- a/hw/9pfs/virtio-9p-device.c
> +++ b/hw/9pfs/virtio-9p-device.c
> @@ -215,6 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev,
> Error **errp) V9fsVirtioState *v = VIRTIO_9P(dev);
>      V9fsState *s = &v->state;
> 
> +    virtio_del_queue(vdev, 0);
>      virtio_cleanup(vdev);
>      v9fs_device_unrealize_common(s, errp);
>  }






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

* Re: [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue
  2020-01-17  6:09 ` [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue pannengyuan
@ 2020-01-17 13:03   ` Christian Schoenebeck
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Schoenebeck @ 2020-01-17 13:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: pannengyuan, mst, groug, zhang.zhanghailiang

On Freitag, 17. Januar 2020 07:09:27 CET pannengyuan@huawei.com wrote:
> From: Pan Nengyuan <pannengyuan@huawei.com>
> 
> Use virtio_delete_queue to make it more clear.
> 
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
> Changes V2 to V1:
> - replace virtio_del_queue to virtio_delete_queue to make it more clear.
> ---
>  hw/9pfs/virtio-9p-device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> index 910dc5045e..b146387ae2 100644
> --- a/hw/9pfs/virtio-9p-device.c
> +++ b/hw/9pfs/virtio-9p-device.c
> @@ -215,7 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev,
> Error **errp) V9fsVirtioState *v = VIRTIO_9P(dev);
>      V9fsState *s = &v->state;
> 
> -    virtio_del_queue(vdev, 0);
> +    virtio_delete_queue(v->vq);
>      virtio_cleanup(vdev);
>      v9fs_device_unrealize_common(s, errp);
>  }

No idea what the deprecation plans of virtio_del_queue() are; no behaviour 
change, so this patch is certainly not high priority. On the other hand though 
this change most certainly will be required on day.

I can imagine Greg might want to see a more verbose commit message, but that's 
beyond my personal detail level, so from my side

Acked-by: Christian Schoenebeck <qemu_oss@crudebyte.com>






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

* Re: [PATCH v2 1/2] virtio-9p-device: fix memleak in virtio_9p_device_unrealize
  2020-01-17 12:52   ` Christian Schoenebeck
@ 2020-01-17 13:43     ` Michael S. Tsirkin
  2020-01-20 13:24       ` Greg Kurz
  0 siblings, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2020-01-17 13:43 UTC (permalink / raw)
  To: Christian Schoenebeck
  Cc: zhang.zhanghailiang, Euler Robot, pannengyuan, qemu-devel, groug

On Fri, Jan 17, 2020 at 01:52:53PM +0100, Christian Schoenebeck wrote:
> On Freitag, 17. Januar 2020 07:09:26 CET pannengyuan@huawei.com wrote:
> > From: Pan Nengyuan <pannengyuan@huawei.com>
> > 
> > v->vq forgot to cleanup in virtio_9p_device_unrealize, the memory leak
> > stack is as follow:
> > 
> > Direct leak of 14336 byte(s) in 2 object(s) allocated from:
> >   #0 0x7f819ae43970 (/lib64/libasan.so.5+0xef970)  ??:?
> >   #1 0x7f819872f49d (/lib64/libglib-2.0.so.0+0x5249d)  ??:?
> >   #2 0x55a3a58da624 (./x86_64-softmmu/qemu-system-x86_64+0x2c14624) 
> > /mnt/sdb/qemu/hw/virtio/virtio.c:2327 #3 0x55a3a571bac7
> > (./x86_64-softmmu/qemu-system-x86_64+0x2a55ac7) 
> > /mnt/sdb/qemu/hw/9pfs/virtio-9p-device.c:209 #4 0x55a3a58e7bc6
> > (./x86_64-softmmu/qemu-system-x86_64+0x2c21bc6) 
> > /mnt/sdb/qemu/hw/virtio/virtio.c:3504 #5 0x55a3a5ebfb37
> > (./x86_64-softmmu/qemu-system-x86_64+0x31f9b37) 
> > /mnt/sdb/qemu/hw/core/qdev.c:876
> > 
> > Reported-by: Euler Robot <euler.robot@huawei.com>
> > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> 
> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> 
> Maybe you could add this patch to your revised PR Greg?

I'm testing all the related virtio changes and they will be
in my next PR.

> > ---
> > Changes V2 to V1:
> > - use old function virtio_del_queue to make it easier for stable branch
> > to merge (suggested by Christian Schoenebeck)
> > ---
> >  hw/9pfs/virtio-9p-device.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> > index b5a7c03f26..910dc5045e 100644
> > --- a/hw/9pfs/virtio-9p-device.c
> > +++ b/hw/9pfs/virtio-9p-device.c
> > @@ -215,6 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev,
> > Error **errp) V9fsVirtioState *v = VIRTIO_9P(dev);
> >      V9fsState *s = &v->state;
> > 
> > +    virtio_del_queue(vdev, 0);
> >      virtio_cleanup(vdev);
> >      v9fs_device_unrealize_common(s, errp);
> >  }
> 
> 
> 



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

* Re: [PATCH v2 1/2] virtio-9p-device: fix memleak in virtio_9p_device_unrealize
  2020-01-17 13:43     ` Michael S. Tsirkin
@ 2020-01-20 13:24       ` Greg Kurz
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kurz @ 2020-01-20 13:24 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: pannengyuan, zhang.zhanghailiang, Christian Schoenebeck,
	qemu-devel, Euler Robot

On Fri, 17 Jan 2020 08:43:42 -0500
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Fri, Jan 17, 2020 at 01:52:53PM +0100, Christian Schoenebeck wrote:
> > On Freitag, 17. Januar 2020 07:09:26 CET pannengyuan@huawei.com wrote:
> > > From: Pan Nengyuan <pannengyuan@huawei.com>
> > > 
> > > v->vq forgot to cleanup in virtio_9p_device_unrealize, the memory leak
> > > stack is as follow:
> > > 
> > > Direct leak of 14336 byte(s) in 2 object(s) allocated from:
> > >   #0 0x7f819ae43970 (/lib64/libasan.so.5+0xef970)  ??:?
> > >   #1 0x7f819872f49d (/lib64/libglib-2.0.so.0+0x5249d)  ??:?
> > >   #2 0x55a3a58da624 (./x86_64-softmmu/qemu-system-x86_64+0x2c14624) 
> > > /mnt/sdb/qemu/hw/virtio/virtio.c:2327 #3 0x55a3a571bac7
> > > (./x86_64-softmmu/qemu-system-x86_64+0x2a55ac7) 
> > > /mnt/sdb/qemu/hw/9pfs/virtio-9p-device.c:209 #4 0x55a3a58e7bc6
> > > (./x86_64-softmmu/qemu-system-x86_64+0x2c21bc6) 
> > > /mnt/sdb/qemu/hw/virtio/virtio.c:3504 #5 0x55a3a5ebfb37
> > > (./x86_64-softmmu/qemu-system-x86_64+0x31f9b37) 
> > > /mnt/sdb/qemu/hw/core/qdev.c:876
> > > 
> > > Reported-by: Euler Robot <euler.robot@huawei.com>
> > > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> > 
> > Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > 
> > Maybe you could add this patch to your revised PR Greg?
> 
> I'm testing all the related virtio changes and they will be
> in my next PR.
> 

Thanks Michael.

You can add this tag for the whole series:

Acked-by: Greg Kurz <groug@kaod.org>

> > > ---
> > > Changes V2 to V1:
> > > - use old function virtio_del_queue to make it easier for stable branch
> > > to merge (suggested by Christian Schoenebeck)
> > > ---
> > >  hw/9pfs/virtio-9p-device.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> > > index b5a7c03f26..910dc5045e 100644
> > > --- a/hw/9pfs/virtio-9p-device.c
> > > +++ b/hw/9pfs/virtio-9p-device.c
> > > @@ -215,6 +215,7 @@ static void virtio_9p_device_unrealize(DeviceState *dev,
> > > Error **errp) V9fsVirtioState *v = VIRTIO_9P(dev);
> > >      V9fsState *s = &v->state;
> > > 
> > > +    virtio_del_queue(vdev, 0);
> > >      virtio_cleanup(vdev);
> > >      v9fs_device_unrealize_common(s, errp);
> > >  }
> > 
> > 
> > 
> 



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

end of thread, other threads:[~2020-01-20 13:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-17  6:09 [PATCH v2 0/2] fix memleaks in virtio_9p_device_unrealize pannengyuan
2020-01-17  6:09 ` [PATCH v2 1/2] virtio-9p-device: fix memleak " pannengyuan
2020-01-17 12:52   ` Christian Schoenebeck
2020-01-17 13:43     ` Michael S. Tsirkin
2020-01-20 13:24       ` Greg Kurz
2020-01-17  6:09 ` [PATCH v2 2/2] virtio-9p-device: convert to new virtio_delete_queue pannengyuan
2020-01-17 13:03   ` Christian Schoenebeck

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).