[PATCH] DevicePool: getInstance with wrong hypervisor segfaults

# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201693372 -3600 # Node ID 9494f6f1f1677389b6ad5dbfb01776795b483d11 # Parent a531911a2284fed43b764f5137b7f84ea135fc50 DevicePool: getInstance with wrong hypervisor segfaults wbemgi 'http://localhost:5988/root/virt:Xen_ProcessorPool.InstanceID="ProcessorPool/0"' on a KVM system segfaults. Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com> diff -r a531911a2284 -r 9494f6f1f167 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Mon Jan 28 12:20:27 2008 -0800 +++ b/src/Virt_DevicePool.c Wed Jan 30 12:42:52 2008 +0100 @@ -826,8 +826,12 @@ CMPIStatus get_pool_inst(const CMPIBroke } conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) - goto out; + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + } inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); if (inst == NULL)

Heidi Eckhart wrote:
# HG changeset patch # User Heidi Eckhart <heidieck@linux.vnet.ibm.com> # Date 1201693372 -3600 # Node ID 9494f6f1f1677389b6ad5dbfb01776795b483d11 # Parent a531911a2284fed43b764f5137b7f84ea135fc50 DevicePool: getInstance with wrong hypervisor segfaults
wbemgi 'http://localhost:5988/root/virt:Xen_ProcessorPool.InstanceID="ProcessorPool/0"' on a KVM system segfaults.
Signed-off-by: Heidi Eckhart <heidieck@linux.vnet.ibm.com>
diff -r a531911a2284 -r 9494f6f1f167 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Mon Jan 28 12:20:27 2008 -0800 +++ b/src/Virt_DevicePool.c Wed Jan 30 12:42:52 2008 +0100 @@ -826,8 +826,12 @@ CMPIStatus get_pool_inst(const CMPIBroke }
conn = connect_by_classname(broker, CLASSNAME(reference), &s); - if (conn == NULL) - goto out; + if (conn == NULL) { + cu_statusf(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + "No such instance"); + goto out; + }
inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference)); if (inst == NULL)
Another nice catch, Heidi. +1 -- -Jay
participants (2)
-
Heidi Eckhart
-
Jay Gagnon