Skip to content
  • Amos Kong's avatar
    qdev: Fix crash by validating the object type · ce0abca3
    Amos Kong authored
    
    
    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: default avatarAmos Kong <akong@redhat.com>
    Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
    ce0abca3