提交 125ac4c0 编写于 作者: J Julio Faracco 提交者: Erik Skultety

uml: umlConnectOpen: Check the driver pointer before accessing it

The pointer related to uml_driver needs to be checked before its usage
inside the function. Some attributes of the driver are being accessed
while the pointer is NULL considering the current logic.
Signed-off-by: NJulio Faracco <jcfaracco@gmail.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 199eee6a
......@@ -1193,6 +1193,13 @@ static virDrvOpenStatus umlConnectOpen(virConnectPtr conn,
{
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* URI was good, but driver isn't active */
if (uml_driver == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("uml state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
/* Check path and tell them correct path if they made a mistake */
if (uml_driver->privileged) {
if (STRNEQ(conn->uri->path, "/system") &&
......@@ -1211,13 +1218,6 @@ static virDrvOpenStatus umlConnectOpen(virConnectPtr conn,
}
}
/* URI was good, but driver isn't active */
if (uml_driver == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("uml state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
if (virConnectOpenEnsureACL(conn) < 0)
return VIR_DRV_OPEN_ERROR;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册