提交 fe7cb869 编写于 作者: C Cole Robinson

qemu: Check driver is initialized up front, to avoid segfault.

If the qemu_driver was not initialized (possibly due to an error on driver
startup), we can segfault if attempting to connect to the URI.
上级 f272378d
......@@ -1867,6 +1867,12 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
if (conn->uri->server != NULL)
return VIR_DRV_OPEN_DECLINED;
if (qemu_driver == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
_("qemu state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
if (qemu_driver->privileged) {
if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) {
......@@ -1883,14 +1889,6 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
return VIR_DRV_OPEN_ERROR;
}
}
/* URI was good, but driver isn't active */
if (qemu_driver == NULL) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
_("qemu state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
}
conn->privateData = qemu_driver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册