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

[libvirt] [PATCH] xen: Don't crash when we fail to init caps



by dereferencing a NULL pointer in the call to
virNodeSuspendGetTargetMask.

Only warn but Don't set an error to not overwrite an error code set by
xenHypervisorMakeCapabilities.
---
 src/xen/xen_hypervisor.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 2bb3466..855576c 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2764,6 +2764,10 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
                                                  utsname.machine,
                                                  cpuinfo,
                                                  capabilities);
+    if (caps == NULL) {
+        VIR_WARN("Failed to get host capabilities");
+        return NULL;
+    }
 
     if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
         VIR_WARN("Failed to get host power management capabilities");
-- 
1.7.8.3


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