|
|
0a122b |
From 3e97a22728afed3c77140486ec3863eba941535b Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Date: Mon, 13 Jan 2014 13:45:57 +0100
|
|
|
0a122b |
Subject: [PATCH 11/16] qdev-monitor: Fix crash when device_add is called with abstract driver
|
|
|
0a122b |
MIME-Version: 1.0
|
|
|
0a122b |
Content-Type: text/plain; charset=UTF-8
|
|
|
0a122b |
Content-Transfer-Encoding: 8bit
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Message-id: <1389620557-30050-1-git-send-email-mst@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56642
|
|
|
0a122b |
O-Subject: [PATCH qemu-kvm RHEL7.0] qdev-monitor: Fix crash when device_add is called with abstract driver
|
|
|
0a122b |
Bugzilla: 1026712
|
|
|
0a122b |
RH-Acked-by: Amos Kong <akong@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
From: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
User is able to crash running QEMU when following monitor
|
|
|
0a122b |
command is called:
|
|
|
0a122b |
|
|
|
0a122b |
device_add intel-hda-generic
|
|
|
0a122b |
|
|
|
0a122b |
Crash is caused by assertion in object_initialize_with_type()
|
|
|
0a122b |
when type is abstract.
|
|
|
0a122b |
|
|
|
0a122b |
Checking if type is abstract before instance is created in
|
|
|
0a122b |
qdev_device_add() allows to prevent crash on incorrect user input.
|
|
|
0a122b |
|
|
|
0a122b |
Cc: qemu-stable@nongnu.org
|
|
|
0a122b |
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
0a122b |
(cherry picked from commit 2fa4e56d88aa0039062bbc7f9a88e9f90c77ed94)
|
|
|
0a122b |
|
|
|
0a122b |
Conflicts:
|
|
|
0a122b |
qdev-monitor.c
|
|
|
0a122b |
|
|
|
0a122b |
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6859928
|
|
|
0a122b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1046007
|
|
|
0a122b |
|
|
|
0a122b |
---
|
|
|
0a122b |
qdev-monitor.c | 6 ++++++
|
|
|
0a122b |
1 file changed, 6 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
qdev-monitor.c | 6 ++++++
|
|
|
0a122b |
1 files changed, 6 insertions(+), 0 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/qdev-monitor.c b/qdev-monitor.c
|
|
|
0a122b |
index f78ff64..979502e 100644
|
|
|
0a122b |
--- a/qdev-monitor.c
|
|
|
0a122b |
+++ b/qdev-monitor.c
|
|
|
0a122b |
@@ -477,6 +477,12 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
+ if (object_class_is_abstract(obj)) {
|
|
|
0a122b |
+ qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver",
|
|
|
0a122b |
+ "non-abstract device type");
|
|
|
0a122b |
+ return NULL;
|
|
|
0a122b |
+ }
|
|
|
0a122b |
+
|
|
|
0a122b |
k = DEVICE_CLASS(obj);
|
|
|
0a122b |
|
|
|
0a122b |
if (!k || k->cannot_instantiate_with_device_add_yet) {
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|