[PATCH 02/10] Fix crash on OOM in parsing CPU mask in domain XML

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The virDomainDefParseXML method did not check the return value
of the virBitmapNew API call for NULL. This lead to a crash on
OOM

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 73ae0b0..240f318 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11188,7 +11188,8 @@ virDomainDefParseXML(xmlDocPtr xml,
             if (VIR_ALLOC(vcpupin) < 0)
                 goto error;
 
-            vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
+            if (!(vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN)))
+                goto error;
             virBitmapCopy(vcpupin->cpumask, def->cpumask);
             vcpupin->vcpuid = i;
             def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]