mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[ACM] Don't use uninitialised struct value if hypercall fails.
From: Jan Beulich <jbeulich@novell.com> Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
eb6f936011
commit
2a46b1b066
1 file changed
+11
-6
@@ -147,9 +147,10 @@ static PyObject *getdecision(PyObject * self, PyObject * args)
|
||||
{
|
||||
char *arg1_name, *arg1, *arg2_name, *arg2, *decision = NULL;
|
||||
struct acm_getdecision getdecision;
|
||||
int xc_handle;
|
||||
int xc_handle, rc;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ssss", &arg1_name, &arg1, &arg2_name, &arg2)) {
|
||||
if (!PyArg_ParseTuple(args, "ssss", &arg1_name,
|
||||
&arg1, &arg2_name, &arg2)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -179,13 +180,17 @@ static PyObject *getdecision(PyObject * self, PyObject * args)
|
||||
getdecision.id2.ssidref = atol(arg2);
|
||||
}
|
||||
|
||||
if (xc_acm_op(xc_handle, ACMOP_getdecision, &getdecision, sizeof(getdecision)) < 0) {
|
||||
if (errno == EACCES)
|
||||
PERROR("ACM operation failed.");
|
||||
}
|
||||
rc = xc_acm_op(xc_handle, ACMOP_getdecision,
|
||||
&getdecision, sizeof(getdecision));
|
||||
|
||||
xc_interface_close(xc_handle);
|
||||
|
||||
if (rc < 0) {
|
||||
if (errno == EACCES)
|
||||
PERROR("ACM operation failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (getdecision.acm_decision == ACM_ACCESS_PERMITTED)
|
||||
decision = "PERMITTED";
|
||||
else if (getdecision.acm_decision == ACM_ACCESS_DENIED)
|
||||
|
||||