From nobody Fri May 17 15:11:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ispras.ru ARC-Seal: i=1; a=rsa-sha256; t=1612849833; cv=none; d=zohomail.com; s=zohoarc; b=Aw14tVKLQ4o7/coidg/myj5vCMTE/y1dO+W+jfu0osTaqoGi5gYmmRofp9EWkGB2A+72TYSh8eKeahipta2XhaWKIo5JaWtCP4DVi/Z1baHyioHW71gP2uxh4/uA8P+/iMnDYTz1Fd4pPM8A9DYqv1U2kiIa2spsgzvqERCPZic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612849833; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rMSrGeRM+rlwW0eKDeIOY5PtLfwdq5mrnd8rO2/4Ti4=; b=FA0e0AThfPyD5rg3I3vgGviXMLg1D/JPtHiWOwB2lHqUtPp5UtvCb3XXmqwFfYcneRS5aNbq/AaFklQQFeEeLmV2dahbA9Zb0PjcKSWPGiBBF6GoPeZ8xI/erfi/1uzSm5+yUiTSy0jvIFvBNwc2kJZcfBeiXrM9QsmxEFQqBjQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612849832939622.65768743698; Mon, 8 Feb 2021 21:50:32 -0800 (PST) Received: from localhost ([::1]:36482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9Lux-0007LS-A0 for importer@patchew.org; Tue, 09 Feb 2021 00:50:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9LuA-0006wR-4H for qemu-devel@nongnu.org; Tue, 09 Feb 2021 00:49:42 -0500 Received: from mail.ispras.ru ([83.149.199.84]:60942) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9Lu8-0001KU-2x for qemu-devel@nongnu.org; Tue, 09 Feb 2021 00:49:41 -0500 Received: from [127.0.1.1] (unknown [62.118.151.149]) by mail.ispras.ru (Postfix) with ESMTPSA id A89E640A1DB0; Tue, 9 Feb 2021 05:49:30 +0000 (UTC) Subject: [PATCH v2] char: don't fail when client is not connected From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Tue, 09 Feb 2021 08:49:30 +0300 Message-ID: <161284977034.741841.12565530923825663110.stgit@pasha-ThinkPad-X280> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=83.149.199.84; envelope-from=pavel.dovgalyuk@ispras.ru; helo=mail.ispras.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, pavel.dovgalyuk@ispras.ru, berrange@redhat.com, marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This patch checks that ioc is not null before using it in tcp socket tcp_chr_add_watch function. The failure occurs in replay mode of the execution, when monitor and serial port are tcp servers, and there are no clients connected to them: -monitor tcp:127.0.0.1:8081,server,nowait -serial tcp:127.0.0.1:8082,server,nowait Signed-off-by: Pavel Dovgalyuk Reviewed-by: Marc-Andr=C3=A9 Lureau --- 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, si= ze_t len) static GSource *tcp_chr_add_watch(Chardev *chr, GIOCondition cond) { SocketChardev *s =3D SOCKET_CHARDEV(chr); + if (!s->ioc) { + return NULL; + } return qio_channel_create_watch(s->ioc, cond); } =20