提交 46a07579 编写于 作者: A Alexander Bulekov 提交者: Stefan Hajnoczi

module: check module wasn't already initialized

The virtual-device fuzzer must initialize QOM, prior to running
vl:qemu_init, so that it can use the qos_graph to identify the arguments
required to initialize a guest for libqos-assisted fuzzing. This change
prevents errors when vl:qemu_init tries to (re)initialize the previously
initialized QOM module.
Signed-off-by: NAlexander Bulekov <alxndr@bu.edu>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NDarren Kenny <darren.kenny@oracle.com>
Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200220041118.23264-4-alxndr@bu.edu
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 7b733862
...@@ -30,6 +30,7 @@ typedef struct ModuleEntry ...@@ -30,6 +30,7 @@ typedef struct ModuleEntry
typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList; typedef QTAILQ_HEAD(, ModuleEntry) ModuleTypeList;
static ModuleTypeList init_type_list[MODULE_INIT_MAX]; static ModuleTypeList init_type_list[MODULE_INIT_MAX];
static bool modules_init_done[MODULE_INIT_MAX];
static ModuleTypeList dso_init_list; static ModuleTypeList dso_init_list;
...@@ -91,11 +92,17 @@ void module_call_init(module_init_type type) ...@@ -91,11 +92,17 @@ void module_call_init(module_init_type type)
ModuleTypeList *l; ModuleTypeList *l;
ModuleEntry *e; ModuleEntry *e;
if (modules_init_done[type]) {
return;
}
l = find_type(type); l = find_type(type);
QTAILQ_FOREACH(e, l, node) { QTAILQ_FOREACH(e, l, node) {
e->init(); e->init();
} }
modules_init_done[type] = true;
} }
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册