]> git.proxmox.com Git - mirror_qemu.git/commit - qdev-monitor.c
qdev-monitor: Set properties after parent is assigned in device_add
authorAmos Kong <akong@redhat.com>
Mon, 3 Mar 2014 07:57:55 +0000 (15:57 +0800)
committerAndreas Färber <afaerber@suse.de>
Wed, 12 Mar 2014 19:13:02 +0000 (20:13 +0100)
commit7b0309490cb108d881a0c66d6b350b4db7b3b4ac
treee8ef8ce540d3fa37372e435e82ac31970e95a969
parent267a3264cdaf0ca945ffc7a60c019ad9f89be8d8
qdev-monitor: Set properties after parent is assigned in device_add

Test steps:
 (qemu) device_add e1000,addr=adsf
  Property 'e1000.addr' doesn't take value 'adsf'
 (qemu) info qtree
  Then qemu crashed.

Currently we set a link to the new device from its parent bus, but the
device hasn't been added to QOM tree yet. When it fails to set properties,
object_unparent() can't clean up the device.

Delay setting of device properties until the device has been added to
the QOM composition tree. This way, when setting a property fails,
object_unparent() can clean up the device properly.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
qdev-monitor.c