]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: process: Enforce 'vcpu' order range to <1,maxvcpus>
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Sep 2016 13:51:14 +0000 (15:51 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 30 Sep 2016 06:25:20 +0000 (08:25 +0200)
The current code that validates duplicate vcpu order would not work
properly if the order would exceed def->maxvcpus. Limit the order to the
interval described.

src/qemu/qemu_process.c

index 3b6e07811d2a0eda9d5bd83ecbc735400a183a62..31c8453173200f33dfcfd660b763edd2fb39bead 100644 (file)
@@ -4811,10 +4811,14 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def)
                 goto cleanup;
             }
 
-            ignore_value(virBitmapSetBit(ordermap, vcpu->order));
+            if (virBitmapSetBit(ordermap, vcpu->order)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("vcpu order '%u' exceeds vcpu count"),
+                               vcpu->order);
+                goto cleanup;
+            }
         }
 
-
         for (j = i + 1; j < (i + vcpupriv->vcpus); j++) {
             subvcpu = virDomainDefGetVcpu(def, j);
             if (subvcpu->hotpluggable != vcpu->hotpluggable ||