All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: don't fail when client is not connected
@ 2021-02-02  7:08 Pavel Dovgalyuk
  2021-02-02  7:27 ` Marc-André Lureau
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Dovgalyuk @ 2021-02-02  7:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, pavel.dovgalyuk, marcandre.lureau

This patch checks that ioc is not null before
using it in tcp socket tcp_chr_add_watch function.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
---
 chardev/char-socket.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 213a4c8dd0..cef1d9438f 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -385,6 +385,9 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t len)
 static GSource *tcp_chr_add_watch(Chardev *chr, GIOCondition cond)
 {
     SocketChardev *s = SOCKET_CHARDEV(chr);
+    if (!s->ioc) {
+        return NULL;
+    }
     return qio_channel_create_watch(s->ioc, cond);
 }
 



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-03  8:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  7:08 [PATCH] char: don't fail when client is not connected Pavel Dovgalyuk
2021-02-02  7:27 ` Marc-André Lureau
2021-02-02  7:33   ` Pavel Dovgalyuk
2021-02-03  8:13     ` Marc-André Lureau
2021-02-03  8:22       ` Pavel Dovgalyuk
2021-02-03  8:38         ` Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.