From: Anthony PERARD Date: Mon, 21 Nov 2022 11:23:01 +0000 (+0100) Subject: libs/light: Propagate libxl__arch_domain_create() return code X-Git-Tag: 4.17.0-rc4~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8cdfbf95b19c01fbb741c41d5ea5a94f8823964c;p=xen.git libs/light: Propagate libxl__arch_domain_create() return code Commit 34990446ca91 started to overwrite the `rc` value from libxl__arch_domain_create(), thus error aren't propagated anymore. Check `rc` value before doing the next thing. Fixes: 34990446ca91 ("libxl: don't ignore the return value from xc_cpuid_apply_policy") Reported-by: Andrew Cooper Signed-off-by: Anthony PERARD Reviewed-by: Jason Andryuk Release-acked-by: Henry Wang --- diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index b59bbe00bb..fa5c79e4f6 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -377,6 +377,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid); rc = libxl__arch_domain_create(gc, d_config, state, domid); + if (rc) goto out; /* Construct a CPUID policy, but only for brand new domains. Domains * being migrated-in/restored have CPUID handled during the @@ -384,6 +385,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, if (!state->restore) rc = libxl__cpuid_legacy(ctx, domid, false, info); +out: return rc; }