]> git.proxmox.com Git - mirror_qemu.git/commit - hw/pci/pci-hotplug-old.c
hmp: do not crash on invalid SCSI hotplug
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 23 Nov 2012 15:56:18 +0000 (16:56 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 26 Nov 2012 15:38:54 +0000 (09:38 -0600)
commitb5007bcc9729acd995518c52eb1038c4d8416b5d
treed6aa11685de65cf05b087d403aea757b3ade9ff3
parentb7f43fe46029d8fd0594cd599fa2599dcce0f553
hmp: do not crash on invalid SCSI hotplug

Commit 0d93692 (qdev: Convert busses to QEMU Object Model, 2012-05-02)
removed a check on the type of the bus where a SCSI disk is hotplugged.
However, hot-plugging to the wrong kind of device now causes a crash
due to either a NULL pointer dereference (avoided by the previous patch)
or a failed QOM cast.

Instead, in this case we need to use object_dynamic_cast and check for
the result, similar to what was done before that commit.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/pci-hotplug.c