diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-12-02 16:29:41 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-12-02 16:29:41 +0000 |
commit | 39032981fa851d25fb27527f25f046fed800e585 (patch) | |
tree | 09d8036107214761b51abffb302ce14b12cb8735 /hw/net/virtio-net.c | |
parent | fb2246882a2c8d7f084ebe0617e97ac78467d156 (diff) | |
parent | cb09104ea8418d9521d9a9d36ea0527b84ce51ac (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2019-12-02' into staging
Error reporting patches for 2019-12-02
# gpg: Signature made Mon 02 Dec 2019 15:17:45 GMT
# gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg: issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-error-2019-12-02:
block/file-posix: Fix laio_init() error handling crash bug
net/virtio: Fix failover error handling crash bugs
net/virtio: Drop useless n->primary_dev not null checks
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r-- | hw/net/virtio-net.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 3c31471026..db3d7c38e6 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2795,6 +2795,7 @@ static bool failover_unplug_primary(VirtIONet *n) static bool failover_replug_primary(VirtIONet *n, Error **errp) { + Error *err = NULL; HotplugHandler *hotplug_ctrl; PCIDevice *pdev = PCI_DEVICE(n->primary_dev); @@ -2806,32 +2807,33 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp) qemu_find_opts("device"), n->primary_device_dict, errp); if (!n->primary_device_opts) { - error_setg(errp, "virtio_net: couldn't find primary device opts"); - goto out; + return false; } } - if (!n->primary_dev) { - error_setg(errp, "virtio_net: couldn't find primary device"); - goto out; - } - n->primary_bus = n->primary_dev->parent_bus; if (!n->primary_bus) { error_setg(errp, "virtio_net: couldn't find primary bus"); - goto out; + return false; } qdev_set_parent_bus(n->primary_dev, n->primary_bus); n->primary_should_be_hidden = false; qemu_opt_set_bool(n->primary_device_opts, - "partially_hotplugged", true, errp); + "partially_hotplugged", true, &err); + if (err) { + goto out; + } hotplug_ctrl = qdev_get_hotplug_handler(n->primary_dev); if (hotplug_ctrl) { - hotplug_handler_pre_plug(hotplug_ctrl, n->primary_dev, errp); + hotplug_handler_pre_plug(hotplug_ctrl, n->primary_dev, &err); + if (err) { + goto out; + } hotplug_handler_plug(hotplug_ctrl, n->primary_dev, errp); } out: - return *errp == NULL; + error_propagate(errp, err); + return !err; } static void virtio_net_handle_migration_primary(VirtIONet *n, @@ -2849,8 +2851,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, } } - if (migration_in_setup(s) && !should_be_hidden && - n->primary_dev) { + if (migration_in_setup(s) && !should_be_hidden) { if (failover_unplug_primary(n)) { vmstate_unregister(n->primary_dev, qdev_get_vmsd(n->primary_dev), n->primary_dev); |