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