[Spice-devel] [PATCH 2/2] server/red_channel: fix segfault on red_channel_destroy if peer already removed

Marc-André Lureau marcandre.lureau at gmail.com
Sun Jan 16 11:09:03 PST 2011


Hi

On Sat, Jan 15, 2011 at 7:57 PM, Alon Levy <alevy at redhat.com> wrote:
> ---
>  server/red_channel.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/server/red_channel.c b/server/red_channel.c
> index 40f3a1f..a13ef0e 100644
> --- a/server/red_channel.c
> +++ b/server/red_channel.c
> @@ -365,7 +365,7 @@ void red_channel_destroy(RedChannel *channel)
>  void red_channel_shutdown(RedChannel *channel)
>  {
>     red_printf("");
> -    if (!channel->peer->shutdown) {
> +    if (channel->peer && !channel->peer->shutdown) {
>         channel->core->watch_update_mask(channel->peer->watch,
>                                          SPICE_WATCH_EVENT_READ);
>         red_channel_pipe_clear(channel);
> --


I had a similar modification locally, but I didn't spent time to
identify exactly what was going on.

 I remember I had to check channel->peer->watch as well, otherwise,
some crashes would still happen.

+    if (channel->peer && !channel->peer->shutdown) {
+        if (channel->peer->watch)
+            channel->core->watch_update_mask(channel->peer->watch,
+                                             SPICE_WATCH_EVENT_READ);

If you have an idea why I needed it, perhaps you can say something
about that second check and if it's still necessary.

cheers

-- 
Marc-André Lureau


More information about the Spice-devel mailing list