]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Add check for invalid iothread_id in qemuDomainChgIOThread
authorJohn Ferlan <jferlan@redhat.com>
Thu, 13 Aug 2015 13:19:01 +0000 (09:19 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 22 Sep 2015 00:18:01 +0000 (20:18 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1251886

Since iothread_id == 0 is an invalid value for QEMU let's point
that out specifically.  For the IOThreadDel code, the failure would
have ended up being a failure to find the IOThread ID; however, for
the IOThreadAdd code - an IOThread 0 was added and that isn't good.

It seems during many reviews/edits to the code the check for
iothread_id = 0 being invalid was lost - it could have originally
been in the API code, but requested to be moved - I cannot remember.

(cherry picked from commit 32c6b1908bbf8a1aa4a2692135e7d02a166a0317)

src/qemu/qemu_driver.c

index 469fcaebd2c5dafe0f4e49dee41a5d571e0bd39a..d6c04f3f6917a9f922ad8f73dc54d42f1e033f8c 100644 (file)
@@ -6136,6 +6136,12 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
     virDomainDefPtr persistentDef;
     int ret = -1;
 
+    if (iothread_id == 0) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid value of 0 for iothread_id"));
+        return -1;
+    }
+
     cfg = virQEMUDriverGetConfig(driver);
 
     priv = vm->privateData;