thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From d2b004602412ce65613b30f28d07ef8607e0d505 Mon Sep 17 00:00:00 2001
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Fri, 17 Jan 2014 17:07:58 +0100
9ae3a8
Subject: [PATCH 08/11] qdev-monitor: Avoid device_add crashing on non-device driver name
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Markus Armbruster <armbru@redhat.com>
9ae3a8
Message-id: <1389978479-30595-9-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 56795
9ae3a8
O-Subject: [PATCH 7.0 qemu-kvm 8/9] qdev-monitor: Avoid device_add crashing on non-device driver name
9ae3a8
Bugzilla: 669524
9ae3a8
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
9ae3a8
Watch this:
9ae3a8
9ae3a8
    $ upstream-qemu -nodefaults -S -display none -monitor stdio
9ae3a8
    QEMU 1.7.50 monitor - type 'help' for more information
9ae3a8
    (qemu) device_add rng-egd
9ae3a8
    /work/armbru/qemu/qdev-monitor.c:491:qdev_device_add: Object 0x2089b00 is not an instance of type device
9ae3a8
    Aborted (core dumped)
9ae3a8
9ae3a8
Crashes because "rng-egd" exists, but isn't a subtype of TYPE_DEVICE.
9ae3a8
Broken in commit 18b6dad.
9ae3a8
9ae3a8
Cc: qemu-stable@nongnu.org
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Signed-off-by: Andreas Färber <afaerber@suse.de>
9ae3a8
(cherry picked from commit 061e84f7a469ad1f94f3b5f6a5361b346ab990e8)
9ae3a8
---
9ae3a8
 qdev-monitor.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 qdev-monitor.c |    2 +-
9ae3a8
 1 files changed, 1 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/qdev-monitor.c b/qdev-monitor.c
9ae3a8
index da7fe0d..55a476b 100644
9ae3a8
--- a/qdev-monitor.c
9ae3a8
+++ b/qdev-monitor.c
9ae3a8
@@ -478,7 +478,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
9ae3a8
         }
9ae3a8
     }
9ae3a8
 
9ae3a8
-    if (!oc) {
9ae3a8
+    if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {
9ae3a8
         qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver", "device type");
9ae3a8
         return NULL;
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8