Received: from eggs.gnu.org ([208.118.235.92]:37695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVKfz-0002C3-4v for qemu-devel@nongnu.org; Thu, 25 Apr 2013 07:49:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVKfu-0007jU-5p for qemu-devel@nongnu.org; Thu, 25 Apr 2013 07:49:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVKft-0007jE-TY for qemu-devel@nongnu.org; Thu, 25 Apr 2013 07:49:18 -0400 From: Hans de Goede Date: Thu, 25 Apr 2013 13:53:02 +0200 Message-Id: <1366890782-10311-1-git-send-email-hdegoede@redhat.com> Subject: [Qemu-devel] [PATCH] qemu-char: Set foo_tag = 0 when returning FALSE from callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah , Paolo Bonzini , Anthony Liguori , Hans de Goede While reviewing some patches I found this problem where tcp_chr_accept does not clear listen_tag when returning FALSE, leading to a double g_source_remove of the underlying source. Not really a problem unless the id gets re-used in between, but still something we should fix. While at it I've also reviewed all the other code in qemu-char.c for similar problems and found that pty_chr_timer has the same problem. Cc: Anthony Liguori Signed-off-by: Hans de Goede --- qemu-char.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index f29f9b1..64e824d 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1077,6 +1077,7 @@ static gboolean pty_chr_timer(gpointer opaque) pty_chr_update_read_handler(chr); out: + s->timer_tag = 0; return FALSE; } @@ -2642,6 +2643,7 @@ static gboolean tcp_chr_accept(GIOChannel *channel, GIOCondition cond, void *opa } fd = qemu_accept(s->listen_fd, addr, &len); if (fd < 0 && errno != EINTR) { + s->listen_tag = 0; return FALSE; } else if (fd >= 0) { if (s->do_telnetopt) -- 1.8.2.1