[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen master] chardev: don't abort on attempt to add duplicated chardev



commit 14a7a203063694ff932f3371ed93e97987dcafc0
Author:     Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
AuthorDate: Mon Jul 6 22:10:34 2020 +0400
Commit:     Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
CommitDate: Mon Jul 13 11:59:47 2020 +0400

    chardev: don't abort on attempt to add duplicated chardev
    
    This is a regression from commit d2623129a7d ("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".
    
    Fixes: d2623129a7dec1d3041ad1221dda1ca49c667532
    Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
    Reviewed-by: Markus Armbruster <armbru@xxxxxxxxxx>
---
 chardev/char.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/chardev/char.c b/chardev/char.c
index e5b43cb4b8..a0626d04d5 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -996,7 +996,11 @@ 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);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.