[Libvirt-cim] [PATCH] Fix segfault in DevicePool when network device source is not defined

Jim Fehlig jfehlig at novell.com
Tue Nov 18 22:25:53 UTC 2008


# HG changeset patch
# User Jim Fehlig <jfehlig at novell.com>
# Date 1227050707 25200
# Node ID 5cfd2bb6424ba4f6edd06425466e26c71b5d8a22
# Parent  087bd497d4ed6fbf1b2a00dac26a7c6f8baf91e2
Fix segfault in DevicePool when network device source is not defined

c/s 752 missed one case of using NULL source field of net_device
structure.  The associated network pool cannot be determined if
source is undefined, so return a NULL pool ID.

Signed-off-by: Jim Fehlig <jfehlig at novell.com>

diff -r 087bd497d4ed -r 5cfd2bb6424b src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c	Tue Nov 18 09:37:05 2008 -0800
+++ b/src/Virt_DevicePool.c	Tue Nov 18 16:25:07 2008 -0700
@@ -388,6 +388,12 @@ static char *_netpool_member_of(virConne
         virNetworkPtr net = NULL;
         const char *netname;
         char *pool = NULL;
+
+        if (ndev->source == NULL) {
+                CU_DEBUG("Unable to determine pool since no network "
+                         "source defined");
+                goto out;
+        }
 
         if (STREQ(ndev->type, "bridge"))
                 net = bridge_to_network(conn, ndev->source);




More information about the Libvirt-cim mailing list