s390x/pci: return directly if create zpci failed
authorYi Min Zhao <zyimin@linux.vnet.ibm.com>
Wed, 10 Aug 2016 08:10:08 +0000 (16:10 +0800)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 5 Sep 2016 13:15:16 +0000 (15:15 +0200)
In the case that zpci is automatically created, we did not return
immediately on failure, which would lead to NULL pointer dereferencing.
Let's fix it.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/s390-pci-bus.c

index 9c1c04e..5750f22 100644 (file)
@@ -649,6 +649,7 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,
             pbdev = s390_pci_device_new(dev->id);
             if (!pbdev) {
                 error_setg(errp, "create zpci device failed");
+                return;
             }
         }