]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Fix possible crash in qemuProcessSetVcpuAffinities
authorPeter Krempa <pkrempa@redhat.com>
Thu, 28 May 2015 14:22:13 +0000 (16:22 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 3 Jun 2015 07:42:07 +0000 (09:42 +0200)
In case when <vcpu ... cpuset=""> is not specified, the vcpupin array is
not guaranteed to be allocated to def->vcpus. This would cause a crash
for TCG since it does not report thread IDs for vCPUs.

src/qemu/qemu_process.c

index 9c5d0f4893446a297811c354fbd4dcac4c9b4219..f2b22292f417f86e7fd71acb1cf2cd1233fa056b 100644 (file)
@@ -2376,7 +2376,7 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
         /* If any CPU has custom affinity that differs from the
          * VM default affinity, we must reject it
          */
-        for (n = 0; n < def->vcpus; n++) {
+        for (n = 0; n < def->cputune.nvcpupin; n++) {
             if (!virBitmapEqual(def->cpumask,
                                 def->cputune.vcpupin[n]->cpumask)) {
                 virReportError(VIR_ERR_OPERATION_INVALID,