* [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL
@ 2010-01-11 17:30 Stefano Stabellini
2010-01-12 19:35 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Stefano Stabellini @ 2010-01-11 17:30 UTC (permalink / raw)
To: qemu-devel
Hi all,
calling vnc_update_client in vnc_refresh might have the unlikely side
effect of setting vd->timer = NULL, if the last vnc client disconnected.
In this case we have to return from vnc_refresh without updating the
timer, otherwise we cause a segfault.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
diff --git a/vnc.c b/vnc.c
index c54c6e0..58eac73 100644
--- a/vnc.c
+++ b/vnc.c
@@ -2305,6 +2305,10 @@ static void vnc_refresh(void *opaque)
rects += vnc_update_client(vs, has_dirty);
vs = vs->next;
}
+ /* vd->timer could be NULL now if the last client disconnected,
+ * in this case don't update the timer */
+ if (vd->timer == NULL)
+ return;
if (has_dirty && rects) {
vd->timer_interval /= 2;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL
2010-01-11 17:30 [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL Stefano Stabellini
@ 2010-01-12 19:35 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2010-01-12 19:35 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: qemu-devel
On 01/11/2010 11:30 AM, Stefano Stabellini wrote:
> Hi all,
> calling vnc_update_client in vnc_refresh might have the unlikely side
> effect of setting vd->timer = NULL, if the last vnc client disconnected.
> In this case we have to return from vnc_refresh without updating the
> timer, otherwise we cause a segfault.
>
> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
>
> diff --git a/vnc.c b/vnc.c
> index c54c6e0..58eac73 100644
> --- a/vnc.c
> +++ b/vnc.c
> @@ -2305,6 +2305,10 @@ static void vnc_refresh(void *opaque)
> rects += vnc_update_client(vs, has_dirty);
> vs = vs->next;
> }
> + /* vd->timer could be NULL now if the last client disconnected,
> + * in this case don't update the timer */
> + if (vd->timer == NULL)
> + return;
>
> if (has_dirty&& rects) {
> vd->timer_interval /= 2;
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-12 19:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 17:30 [Qemu-devel] [PATCH] vnc_refresh: return if vd->timer is NULL Stefano Stabellini
2010-01-12 19:35 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).