[libvirt] [PATCH 1/5] qemu: parse: Validate that the VM has at least one cpu

Peter Krempa pkrempa at redhat.com
Mon Nov 14 16:53:47 UTC 2016


Libvirt's code relies on this fact so don't allow parsing a command line
which would have none.

Libvirtd would crash in the post parse callback on such config.
---
 src/qemu/qemu_parse_command.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index c3b27aa..b19c523 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -1702,6 +1702,9 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
     if (maxcpus == 0)
         maxcpus = vcpus;

+    if (maxcpus == 0)
+        goto syntax;
+
     if (virDomainDefSetVcpusMax(dom, maxcpus, xmlopt) < 0)
         goto error;

-- 
2.10.2




More information about the libvir-list mailing list