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

Heidi Eckhart heidieck at linux.vnet.ibm.com
Wed Jan 30 11:30:32 UTC 2008


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1201693929 -3600
# Node ID d7a8461a61dcf13ff9d0ab2220b78d9748818cb4
# Parent  9494f6f1f1677389b6ad5dbfb01776795b483d11
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 9494f6f1f167 -r d7a8461a61dc src/Virt_Device.c
--- a/src/Virt_Device.c	Wed Jan 30 12:42:52 2008 +0100
+++ b/src/Virt_Device.c	Wed Jan 30 12:52:09 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