All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object
@ 2016-11-23 11:49 Gonglei
  2017-01-09  2:05 ` Gonglei (Arei)
  0 siblings, 1 reply; 2+ messages in thread
From: Gonglei @ 2016-11-23 11:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber, Gonglei

If we assign the user crateable object in QEMU command
line, then the correspeonding qemu_opts for the object
doesn't be deleted, which will produce a wrong result.

If we hot unplug the object by object_del, the qemu_opts
will be leaked, ann then if we hot plug the object using
the same id by object_add, we will get a error:
 "Duplicate ID 'xxxx' for object"

Let's del the qemu opts after the object created, just
likes what the hmp_object_add function does.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 qom/object_interfaces.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index ded4d84..b8fe9db 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -189,6 +189,10 @@ int user_creatable_add_opts_foreach(void *opaque, QemuOpts *opts, Error **errp)
         return -1;
     }
     object_unref(obj);
+
+    qemu_opts_del(opts);
+    opts = NULL;
+
     return 0;
 }
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object
  2016-11-23 11:49 [Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object Gonglei
@ 2017-01-09  2:05 ` Gonglei (Arei)
  0 siblings, 0 replies; 2+ messages in thread
From: Gonglei (Arei) @ 2017-01-09  2:05 UTC (permalink / raw)
  To: Gonglei (Arei), qemu-devel; +Cc: afaerber, stefanha

Ping...

Anybody can pick it up? Thanks!

Regards,
-Gonglei


> -----Original Message-----
> From: Gonglei (Arei)
> Sent: Wednesday, November 23, 2016 7:50 PM
> To: qemu-devel@nongnu.org
> Cc: afaerber@suse.de; Gonglei (Arei)
> Subject: [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object
> 
> If we assign the user crateable object in QEMU command
> line, then the correspeonding qemu_opts for the object
> doesn't be deleted, which will produce a wrong result.
> 
> If we hot unplug the object by object_del, the qemu_opts
> will be leaked, ann then if we hot plug the object using
> the same id by object_add, we will get a error:
>  "Duplicate ID 'xxxx' for object"
> 
> Let's del the qemu opts after the object created, just
> likes what the hmp_object_add function does.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  qom/object_interfaces.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
> index ded4d84..b8fe9db 100644
> --- a/qom/object_interfaces.c
> +++ b/qom/object_interfaces.c
> @@ -189,6 +189,10 @@ int user_creatable_add_opts_foreach(void *opaque,
> QemuOpts *opts, Error **errp)
>          return -1;
>      }
>      object_unref(obj);
> +
> +    qemu_opts_del(opts);
> +    opts = NULL;
> +
>      return 0;
>  }
> 
> --
> 1.8.3.1
> 

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

end of thread, other threads:[~2017-01-09  2:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 11:49 [Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object Gonglei
2017-01-09  2:05 ` Gonglei (Arei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.