qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] chardev: don't abort on attempt to add duplicated chardev
@ 2020-07-06 18:21 Marc-André Lureau
  2020-07-06 18:31 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc-André Lureau @ 2020-07-06 18:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: eric.auger, armbru, Marc-André Lureau

This is a regression from commit
d2623129a7dec1d3041ad1221dda1ca49c667532 ("qom: Drop parameter @errp of
object_property_add() & friends").

(qemu) chardev-add id=null,backend=null
(qemu) chardev-add id=null,backend=null
Unexpected error in object_property_try_add() at /home/elmarco/src/qemu/qom/object.c:1166:
attempt to add duplicate property 'null' to object (type 'container')

That case is currently not covered in the test suite, but will be with
the queued patch "char: fix use-after-free with dup chardev &
reconnect".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 chardev/char.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/chardev/char.c b/chardev/char.c
index e3051295ac3..876e41bb592 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -998,7 +998,10 @@ static Chardev *chardev_new(const char *id, const char *typename,
     }
 
     if (id) {
-        object_property_add_child(get_chardevs_root(), id, obj);
+        object_property_try_add_child(get_chardevs_root(), id, obj, &local_err);
+        if (local_err) {
+            goto end;
+        }
         object_unref(obj);
     }
 
-- 
2.27.0.90.geebb51ba8c



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

end of thread, other threads:[~2020-07-09  0:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-06 18:21 [PATCH] chardev: don't abort on attempt to add duplicated chardev Marc-André Lureau
2020-07-06 18:31 ` no-reply
2020-07-06 18:31 ` no-reply
2020-07-08  4:51 ` Markus Armbruster

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