aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/domctl.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2012-09-03 09:40:38 +0200
committerJan Beulich <jbeulich@suse.com>2012-09-03 09:40:38 +0200
commit8e66050e3223a9aa55ca29ec32b2e78c3e69e085 (patch)
tree22bf4997c2366565228de8bb0a31c0eaf4873be5 /xen/common/domctl.c
parentf1297904185f73262522b6277252bfb699644766 (diff)
downloadxen-8e66050e3223a9aa55ca29ec32b2e78c3e69e085.tar.gz
xen-8e66050e3223a9aa55ca29ec32b2e78c3e69e085.tar.bz2
xen-8e66050e3223a9aa55ca29ec32b2e78c3e69e085.zip
make domain_create() return a proper error code
While triggered by the XSA-9 fix, this really is of more general use; that fix just pointed out very sharply that the current situation with all domain creation failures reported to user (tools) space as -ENOMEM is very unfortunate (actively misleading users _and_ support personnel). Pull over the pointer <-> error code conversion infrastructure from Linux, and use it in domain_create() and all it callers. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/domctl.c')
-rw-r--r--xen/common/domctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 7ca6b08fa5..2b1f1829da 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -9,6 +9,7 @@
#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
+#include <xen/err.h>
#include <xen/mm.h>
#include <xen/sched.h>
#include <xen/sched-if.h>
@@ -455,10 +456,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_oos_off )
domcr_flags |= DOMCRF_oos_off;
- ret = -ENOMEM;
d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref);
- if ( d == NULL )
+ if ( IS_ERR(d) )
+ {
+ ret = PTR_ERR(d);
break;
+ }
ret = 0;