diff mbox series

[XEN] libxl: fix cleanup bug in initiate_domain_create()

Message ID f6691746dcbdc30a14dbe36d219697187afe502b.1584098295.git.pawel@invisiblethingslab.com (mailing list archive)
State New, archived
Headers show
Series [XEN] libxl: fix cleanup bug in initiate_domain_create() | expand

Commit Message

Paweł Marczewski March 13, 2020, 11:25 a.m. UTC
In case of errors, we immediately call domcreate_complete()
which cleans up the console_xswait object. Make sure it is initialized
before we start cleanup.

Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
---
This is a follow up to my previous patch, 'libxl: wait for console path before
firing console_available'. We discovered the bug when running integration tests
for Qubes OS (and verified that this patch helps). Sorry for the trouble.

 tools/libxl/libxl_create.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ian Jackson March 13, 2020, 11:33 a.m. UTC | #1
Paweł Marczewski writes ("[XEN PATCH] libxl: fix cleanup bug in initiate_domain_create()"):
> In case of errors, we immediately call domcreate_complete()
> which cleans up the console_xswait object. Make sure it is initialized
> before we start cleanup.
> 
> Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>

Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

I will push this in a moment.

Thanks,
Ian.
diff mbox series

Patch

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index ada942bc8d..fc36c4263d 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1102,6 +1102,8 @@  static void initiate_domain_create(libxl__egc *egc,
     libxl_domain_config *const d_config = dcs->guest_config;
     const int restore_fd = dcs->restore_fd;
 
+    libxl__xswait_init(&dcs->console_xswait);
+
     domid = dcs->domid;
     libxl__domain_build_state_init(&dcs->build_state);
 
@@ -1153,8 +1155,6 @@  static void initiate_domain_create(libxl__egc *egc,
     if (ret)
         goto error_out;
 
-    libxl__xswait_init(&dcs->console_xswait);
-
     if (restore_fd >= 0 || dcs->soft_reset) {
         LOGD(DEBUG, domid, "restoring, not running bootloader");
         domcreate_bootloader_done(egc, &dcs->bl, 0);