[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] qdev-monitor: Fix crash when device_add is called with abstract driver



commit 2cafbbf1e03b954dedd3643ab3a4ffe685a63ccf
Author:     Igor Mammedov <imammedo@xxxxxxxxxx>
AuthorDate: Tue Sep 17 15:32:32 2013 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Dec 9 11:40:30 2013 -0600

    qdev-monitor: Fix crash when device_add is called with abstract driver
    
    User is able to crash running QEMU when following monitor
    command is called:
    
     device_add intel-hda-generic
    
    Crash is caused by assertion in object_initialize_with_type()
    when type is abstract.
    
    Checking if type is abstract before instance is created in
    qdev_device_add() allows to prevent crash on incorrect user input.
    
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Igor Mammedov <imammedo@xxxxxxxxxx>
    Signed-off-by: Andreas Färber <afaerber@xxxxxxx>
    (cherry picked from commit 2fa4e56d88aa0039062bbc7f9a88e9f90c77ed94)
    
    Conflicts:
    
        qdev-monitor.c
    
    *updated to reflect different 1.6 variable names
    
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 qdev-monitor.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/qdev-monitor.c b/qdev-monitor.c
index 410cdcb..bb2e1b6 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -472,6 +472,12 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
 
+    if (object_class_is_abstract(obj)) {
+        qerror_report(QERR_INVALID_PARAMETER_VALUE, "driver",
+                      "non-abstract device type");
+        return NULL;
+    }
+
     k = DEVICE_CLASS(obj);
 
     /* find bus */
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.