ChangeSet 1.1373, 2005/04/23 12:04:40+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
xc_domain.c:
Ensure ctxt is mlocked in xc_domain_getfullinfo.
xc_domain.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff -Nru a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c 2005-04-23 08:03:03 -04:00
+++ b/tools/libxc/xc_domain.c 2005-04-23 08:03:03 -04:00
@@ -146,7 +146,7 @@
xc_domaininfo_t *info,
full_execution_context_t *ctxt)
{
- int rc;
+ int rc, errno_saved;
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
@@ -154,12 +154,23 @@
op.u.getdomaininfo.exec_domain = (u16)vcpu;
op.u.getdomaininfo.ctxt = ctxt;
+ if ( (ctxt != NULL) &&
+ ((rc = mlock(ctxt, sizeof(*ctxt))) != 0) )
+ return rc;
+
rc = do_dom0_op(xc_handle, &op);
- if ( info )
+ if ( ctxt != NULL )
+ {
+ errno_saved = errno;
+ (void)munlock(ctxt, sizeof(*ctxt));
+ errno = errno_saved;
+ }
+
+ if ( info != NULL )
memcpy(info, &op.u.getdomaininfo, sizeof(*info));
- if ( ((u16)op.u.getdomaininfo.domain != domid) && rc > 0 )
+ if ( ((u16)op.u.getdomaininfo.domain != domid) && (rc > 0) )
return -ESRCH;
else
return rc;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|