]> git.proxmox.com Git - mirror_qemu.git/commit
qdev: Fix crash by validating the object type
authorAmos Kong <akong@redhat.com>
Wed, 16 Apr 2014 01:57:14 +0000 (09:57 +0800)
committerAndreas Färber <afaerber@suse.de>
Mon, 5 May 2014 17:08:49 +0000 (19:08 +0200)
commitce0abca3e35a9f95e9edcb5d6b2910b2fcd52099
treed1c3e5bc246a0e942935ab5db0985b6eda634d64
parentfdaad4715ae9e998fd0595bedfb16fdaf0c68ccc
qdev: Fix crash by validating the object type

QEMU crashed when I try to list device parameters and the driver name is
actually an available bus name.

 # qemu -device virtio-pci-bus,?
 # qemu -device virtio-bus,?
 # qemu -device virtio-serial-bus,?
 qdev-monitor.c:212:qdev_device_help: Object 0x7fd932f50620 is not an
 instance of type device
 Aborted (core dumped)

We can also reproduce this bug by adding device from monitor, so it's
worth to fix the crash.

 (qemu) device_add virtio-serial-bus
 qdev-monitor.c:491:qdev_device_add: Object 0x7f5e89530920 is not an
 instance of type device
 Aborted (core dumped)

Cc: qemu-stable@nongnu.org
Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
qdev-monitor.c