[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] libxl: Fix segfault in device_model_spawn_outcome



commit d4f3d35f043f6ef29393166b0dd131c8102cf255
Author:     Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Thu Feb 29 08:18:38 2024 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 29 08:18:38 2024 +0100

    libxl: Fix segfault in device_model_spawn_outcome
    
    libxl__spawn_qdisk_backend() explicitly sets guest_config to NULL when
    starting QEMU (the usual launch through libxl__spawn_local_dm() has a
    guest_config though).
    
    Bail early on a NULL guest_config/d_config.  This skips the QMP queries
    for chardevs and VNC, but this xenpv QEMU instance isn't expected to
    provide those - only qdisk (or 9pfs backends after an upcoming change).
    
    Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Acked-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libs/light/libxl_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index dc4c2dfb9f..0b03a7c747 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -3172,8 +3172,8 @@ static void device_model_spawn_outcome(libxl__egc *egc,
 
     /* Check if spawn failed */
     if (rc) goto out;
-
-    if (d_config->b_info.device_model_version
+    /* d_config is NULL for xl devd/libxl__spawn_qemu_xenpv_backend(). */
+    if (d_config && d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
         rc = libxl__ev_time_register_rel(ao, &dmss->timeout,
                                          devise_model_postconfig_timeout,
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.