|
|
9119d9 |
From 4289ddc2407cd074f68d29fd4620fd84f2d6b10d Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <4289ddc2407cd074f68d29fd4620fd84f2d6b10d@dist-git>
|
|
|
9119d9 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
Date: Mon, 3 Nov 2014 09:29:13 -0500
|
|
|
9119d9 |
Subject: [PATCH] hotplug: fix char device detach
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1141621
|
|
|
9119d9 |
|
|
|
9119d9 |
Hotplugging and hotunplugging char devices is only supported through
|
|
|
9119d9 |
'-device' and the check for device capability should be independently.
|
|
|
9119d9 |
|
|
|
9119d9 |
Coverity also complains about 'tmpChr->info.alias' could be NULL and we
|
|
|
9119d9 |
are dereferencing it but it somehow only in this case don't recognize
|
|
|
9119d9 |
that the value is set by 'qemuAssignDeviceChrAlias' so it's clearly
|
|
|
9119d9 |
false positive. Add sa_assert to make coverity happy.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit e7e05801e5e81bd80ea7dd9f0e0ae37f43ec49ad)
|
|
|
9119d9 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_hotplug.c | 13 +++++++++----
|
|
|
9119d9 |
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
9119d9 |
index fd4a8f2..54febb3 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
9119d9 |
@@ -3712,12 +3712,17 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
|
|
|
9119d9 |
return ret;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
|
|
|
9119d9 |
- !tmpChr->info.alias) {
|
|
|
9119d9 |
- if (qemuAssignDeviceChrAlias(vmdef, tmpChr, -1) < 0)
|
|
|
9119d9 |
- return ret;
|
|
|
9119d9 |
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
|
9119d9 |
+ _("qemu does not support -device"));
|
|
|
9119d9 |
+ return ret;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (!tmpChr->info.alias && qemuAssignDeviceChrAlias(vmdef, tmpChr, -1) < 0)
|
|
|
9119d9 |
+ return ret;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ sa_assert(tmpChr->info.alias);
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (qemuBuildChrDeviceStr(&devstr, vm->def, chr, priv->qemuCaps) < 0)
|
|
|
9119d9 |
return ret;
|
|
|
9119d9 |
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|