diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2014-04-16 14:39:38 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-04-25 11:08:34 -0400 |
commit | c3481247e58ff3f13337ce0a262b058799bd156c (patch) | |
tree | f23c7e40beebc16fd106c46f9b437e82d873d8c0 /hmp-commands.hx | |
parent | 2da1b3abbccd267f09ebda7ba604fbbb0220f406 (diff) |
qmp: object-add: Validate class before creating object
Currently it is very easy to crash QEMU by issuing an object-add command
using an abstract class or a class that doesn't support
TYPE_USER_CREATABLE as parameter.
Example: with the following QMP command:
(QEMU) object-add qom-type=cpu id=foo
QEMU aborts at:
ERROR:qom/object.c:335:object_initialize_with_type: assertion failed: (type->abstract == false)
This patch moves the check for TYPE_USER_CREATABLE before object_new(),
and adds a check to prevent the code from trying to instantiate abstract
classes.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Tested-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'hmp-commands.hx')
0 files changed, 0 insertions, 0 deletions