From 99f00fb8bc19f7fa17fb55d7f7ac60c32f29ef9d Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Sun, 12 Feb 2017 17:58:05 +0100 Subject: [PATCH] qemu_driver: check whether iothread is used by controller This follows the same check for disk, because we cannot remove iothread if it's used by disk or by controller. It could lead to crashing QEMU. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 98cf06bd68..013add5e9b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5749,6 +5749,16 @@ qemuDomainDelIOThreadCheck(virDomainDefPtr def, } } + for (i = 0; i < def->ncontrollers; i++) { + if (def->controllers[i]->iothread == iothread_id) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot remove IOThread '%u' since it " + "is being used by controller"), + iothread_id); + return -1; + } + } + return 0; } -- 2.39.5