[libvirt] [PATCH] Fix segfault if virtual network has no bridge listed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The attached patch fixes a libvirtd segfault if we try to call
virNetworkGetBridgeName on a virtual network with no bridge in its xml.
This occurs if the network hasn't been started as long as the daemon has
been running.

This patch also cleans up an error path in qemu_conf which was
overwriting the error returned by virNetworkGetBridgeName.

Thanks,
Cole
diff --git a/src/network_driver.c b/src/network_driver.c
index f233dca..0978341 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -1182,6 +1182,13 @@ static char *networkGetBridgeName(virNetworkPtr net) {
         goto cleanup;
     }
 
+    if (!(network->def->bridge)) {
+        networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
+                           _("network '%s' does not have a bridge name."),
+                           network->def->name);
+        goto cleanup;
+    }
+
     bridge = strdup(network->def->bridge);
     if (!bridge)
         networkReportError(net->conn, NULL, net, VIR_ERR_NO_MEMORY,
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index e6c378f..ff1cd29 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -549,9 +549,6 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
         virNetworkFree(network);
 
         if (brname == NULL) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Network '%s' is not active"),
-                             net->data.network.name);
             goto error;
         }
     } else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]