Re: [Spice-devel] [PATCH] server: fix segfault if no migrate_info provided
On Tue, Jul 05, 2011 at 04:12:47PM +0300, Yonit Halperin wrote: On 07/05/2011 03:22 PM, Alon Levy wrote: 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; +} ACK. can you also add a red_printf here? Added and pushed. 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@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH] server: fix segfault if no migrate_info provided
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@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH] server: fix segfault if no migrate_info provided
On 07/05/2011 03:22 PM, Alon Levy wrote: 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; +} ACK. can you also add a red_printf here? 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@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel