Blame SOURCES/libvirt-qemu-Add-check-for-invalid-iothread_id-in-qemuDomainChgIOThread.patch

7a3408
From e654ad03a40a7f908704ec28cb50c38267eb7bff Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <e654ad03a40a7f908704ec28cb50c38267eb7bff@dist-git>
7a3408
From: John Ferlan <jferlan@redhat.com>
7a3408
Date: Tue, 18 Aug 2015 14:47:15 -0400
7a3408
Subject: [PATCH] qemu: Add check for invalid iothread_id in
7a3408
 qemuDomainChgIOThread
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1251886
7a3408
7a3408
Since iothread_id == 0 is an invalid value for QEMU let's point
7a3408
that out specifically.  For the IOThreadDel code, the failure would
7a3408
have ended up being a failure to find the IOThread ID; however, for
7a3408
the IOThreadAdd code - an IOThread 0 was added and that isn't good.
7a3408
7a3408
It seems during many reviews/edits to the code the check for
7a3408
iothread_id = 0 being invalid was lost - it could have originally
7a3408
been in the API code, but requested to be moved - I cannot remember.
7a3408
7a3408
(cherry picked from commit 32c6b1908bbf8a1aa4a2692135e7d02a166a0317)
7a3408
Signed-off-by: John Ferlan <jferlan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_driver.c | 6 ++++++
7a3408
 1 file changed, 6 insertions(+)
7a3408
7a3408
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7a3408
index 748f16a..ec61bb5 100644
7a3408
--- a/src/qemu/qemu_driver.c
7a3408
+++ b/src/qemu/qemu_driver.c
7a3408
@@ -6152,6 +6152,12 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
7a3408
     virDomainDefPtr persistentDef;
7a3408
     int ret = -1;
7a3408
 
7a3408
+    if (iothread_id == 0) {
7a3408
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
7a3408
+                       _("invalid value of 0 for iothread_id"));
7a3408
+        return -1;
7a3408
+    }
7a3408
+
7a3408
     cfg = virQEMUDriverGetConfig(driver);
7a3408
 
7a3408
     priv = vm->privateData;
7a3408
-- 
7a3408
2.5.0
7a3408