[Libvirt-cim] [PATCH 1 of 3] Device: getInstance with wrong hypervisor segfaults

Heidi Eckhart heidieck at linux.vnet.ibm.com
Thu Jan 31 09:02:30 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1201773643 -3600
# Node ID 277d2b8395e2460a355973309ed14c06e1ef9038
# Parent  2920e184226248f7885dd87a28e30eb1a90005c9
Device: getInstance with wrong hypervisor segfaults

wbemgi 'http://localhost:5988/root/virt:Xen_LogicalDisk.DeviceID="qemu1/hda",CreationClassName="KVM_LogicalDisk",SystemName="qemu1",SystemCreationClassName=""'
on a KVM system segfaults.

Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r 2920e1842262 -r 277d2b8395e2 src/Virt_Device.c
--- a/src/Virt_Device.c	Wed Jan 30 10:52:58 2008 -0800
+++ b/src/Virt_Device.c	Thu Jan 31 11:00:43 2008 +0100
@@ -464,8 +464,12 @@ static CMPIStatus get_device(const CMPIO
         cn = CLASSNAME(reference);
 
         conn = connect_by_classname(_BROKER, cn, &s);
-        if (!conn)
-                return s;
+        if (conn == NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_NOT_FOUND,
+                           "No such instance");
+                goto out;
+        }
 
         inst = instance_from_devid(_BROKER,
                                    conn,
@@ -481,6 +485,7 @@ static CMPIStatus get_device(const CMPIO
                            "Unable to get device instance");
         }
 
+ out:
         virConnectClose(conn);
 
         return s;                




More information about the Libvirt-cim mailing list