[Xen-devel] [XEN PATCH] libxl: fix cleanup bug in initiate_domain_create()

Paweł Marczewski posted 1 patch 4 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/f6691746dcbdc30a14dbe36d219697187afe502b.1584098295.git.pawel@invisiblethingslab.com
tools/libxl/libxl_create.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Xen-devel] [XEN PATCH] libxl: fix cleanup bug in initiate_domain_create()
Posted by Paweł Marczewski 4 years ago
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(-)

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);
-- 
2.24.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH] libxl: fix cleanup bug in initiate_domain_create()
Posted by Ian Jackson 4 years ago
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.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel