Skip to content

Commit

Permalink
chardev: don't abort on attempt to add duplicated chardev
Browse files Browse the repository at this point in the history
This is a regression from commit d262312 ("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: d262312
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
  • Loading branch information
elmarco committed Jul 13, 2020
1 parent 2b61bb7 commit 14a7a20
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chardev/char.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 14a7a20

Please sign in to comment.