The function domcreate_bootloader_done may branch early to
domcreate_stream_done, in case some error occoured. Here srs->dcs will be
NULL, which leads to a crash.
It is unclear what the purpose of that backpointer is. Perhaps it can be
removed, and domcreate_stream_done could use CONTAINER_OF.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[ wei: fold in comment required by Ian ]
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
return;
}
+ /* Prepare environment for domcreate_stream_done */
+ dcs->srs.dcs = dcs;
+
/* Restore */
callbacks->restore_results = libxl__srm_callout_callback_restore_results;
goto out;
dcs->srs.ao = ao;
- dcs->srs.dcs = dcs;
dcs->srs.fd = restore_fd;
dcs->srs.legacy = (dcs->restore_params.stream_version == 1);
dcs->srs.back_channel = false;
libxl__stream_read_state *srs,
int ret)
{
+ /* NB perhaps only srs->dcs is valid; eg in the case of an
+ * early branch to domcreate_bootloader_done's `out' block */
libxl__domain_create_state *dcs = srs->dcs;
STATE_AO_GC(dcs->ao);
libxl_ctx *ctx = libxl__gc_owner(gc);