[Spice-devel] [PATCH] server: fix segfault if no migrate_info provided
Alon Levy
alevy at redhat.com
Tue Jul 5 05:22:25 PDT 2011
On Mon, Jun 20, 2011 at 10:57:58AM +0200, Alon Levy wrote:
ping?
> qemu calls spice_server_migrate_switch even if it didn't do a
> spice_server_migrate_info first. Fix the resulting error by not pushing
> a switch host tag to the pipe in this case, and add a check anyway in the
> marshalling code just in case.
> ---
> server/reds.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/server/reds.c b/server/reds.c
> index 5fa50c1..5214ae7 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3102,12 +3102,23 @@ static void reds_mig_finished(int completed)
>
> static void reds_mig_switch(void)
> {
> + if (!reds->mig_spice) {
> + // don't send a switch host if migrate info is not provided
> + return;
> + }
> main_channel_push_migrate_switch(reds->main_channel);
> }
>
> void reds_fill_mig_switch(SpiceMsgMainMigrationSwitchHost *migrate)
> {
> RedsMigSpice *s = reds->mig_spice;
> +
> + if (s == NULL) {
> + red_printf(
> + "error: reds_fill_mig_switch called without migrate info set");
> + bzero(migrate, sizeof(*migrate));
> + return;
> + }
> migrate->port = s->port;
> migrate->sport = s->sport;
> migrate->host_size = strlen(s->host) + 1;
> --
> 1.7.5.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list