diff mbox series

[1/2] libxl: Fix segfault in device_model_spawn_outcome

Message ID 20240109170540.38239-2-jandryuk@gmail.com (mailing list archive)
State New, archived
Headers show
Series libxl: devd support for QEMU 9pfs | expand

Commit Message

Jason Andryuk Jan. 9, 2024, 5:05 p.m. UTC
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@gmail.com>
---
 tools/libs/light/libxl_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Anthony PERARD Feb. 28, 2024, 3:36 p.m. UTC | #1
On Tue, Jan 09, 2024 at 12:05:39PM -0500, Jason Andryuk wrote:
> 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@gmail.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
diff mbox series

Patch

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index f7c796011d..6ef16ad2a0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -3161,8 +3161,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,