hw/pci: fix error flow in pci multifunction init
commit306077640a652e090779498aadbeb0c605feaacd
authorMarcel Apfelbaum <marcel.a@redhat.com>
Tue, 21 Jan 2014 16:37:51 +0000 (21 18:37 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 26 Jan 2014 11:11:45 +0000 (26 13:11 +0200)
treef8169efccfff4c0d7b2b01508d3c824fcb148f0a
parentb8124cecb55b3bc4e7dee0ff34b294942044d74a
hw/pci: fix error flow in pci multifunction init

Scenario:
  - There is a non multifunction pci device A on 00:0X.0.
  - Hot-plug another multifunction pci device B at 00:0X.1.
  - The operation will fail of course.
  - Try to hot-plug the B device 2-3 more times, qemu will crash.

Reason: The error flow leaves the B's address space into global address spaces
list, but the device object is freed. Fixed that.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci/pci.c