diff mbox series

[XEN,for-4.17] libs/light: Propagate libxl__arch_domain_create() return code

Message ID 20221118165235.14143-1-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series [XEN,for-4.17] libs/light: Propagate libxl__arch_domain_create() return code | expand

Commit Message

Anthony PERARD Nov. 18, 2022, 4:52 p.m. UTC
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 <andrew.cooper3@citrix.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_dom.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Henry Wang Nov. 19, 2022, 1:39 a.m. UTC | #1
Hi Anthony,

> -----Original Message-----
> From: Anthony PERARD <anthony.perard@citrix.com>
> Subject: [XEN PATCH for-4.17] 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 <andrew.cooper3@citrix.com>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Release-acked-by: Henry Wang <Henry.Wang@arm.com>

Kind regards,
Henry
Jason Andryuk Nov. 19, 2022, 2:37 p.m. UTC | #2
On Fri, Nov 18, 2022 at 11:53 AM Anthony PERARD
<anthony.perard@citrix.com> wrote:
>
> 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 <andrew.cooper3@citrix.com>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Was the issue that libxl__arch_domain_create() failed, but then
libxl__cpuid_legacy() succeeded.  rc was overwritten, so
libxl__build_pre() returns success?

Reviewed-by: Jason Andryuk <jandryuk@gmail.com>

Thanks,
Jason
diff mbox series

Patch

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;
 }