From patchwork Fri Mar 18 18:00:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 8622761 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 79497C0553 for ; Fri, 18 Mar 2016 18:01:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E01CE202BE for ; Fri, 18 Mar 2016 18:01:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3841720279 for ; Fri, 18 Mar 2016 18:01:04 +0000 (UTC) Received: from localhost ([::1]:45441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agyhr-0002Ln-HI for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 14:01:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agyhj-0002Ld-Su for qemu-devel@nongnu.org; Fri, 18 Mar 2016 14:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agyhh-0001WJ-7Z for qemu-devel@nongnu.org; Fri, 18 Mar 2016 14:00:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agyhh-0001WF-2S for qemu-devel@nongnu.org; Fri, 18 Mar 2016 14:00:53 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5A77AC05005F; Fri, 18 Mar 2016 18:00:52 +0000 (UTC) Received: from t530wlan.home.berrange.com.com ([10.42.17.224]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2II0oOO006754; Fri, 18 Mar 2016 14:00:50 -0400 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Fri, 18 Mar 2016 18:00:41 +0000 Message-Id: <1458324041-22709-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Laurent Vivier , Paolo Bonzini , Andrew Baumann Subject: [Qemu-devel] [PATCH] char: ensure all clients are in non-blocking mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only some callers of tcp_chr_new_client are putting the socket client into non-blocking mode. Move the call to qio_channel_set_blocking() into the tcp_chr_new_client method to guarantee that all code paths set non-blocking mode Reported-by: Andrew Baumann Reported-by: Laurent Vivier Signed-off-by: Daniel P. Berrange --- qemu-char.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-char.c b/qemu-char.c index bfcf80d..144764e 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3071,6 +3071,8 @@ static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc) s->sioc = sioc; object_ref(OBJECT(sioc)); + qio_channel_set_blocking(s->ioc, false, NULL); + if (s->do_nodelay) { qio_channel_set_delay(s->ioc, false); } @@ -3102,7 +3104,6 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd) if (!sioc) { return -1; } - qio_channel_set_blocking(QIO_CHANNEL(sioc), false, NULL); ret = tcp_chr_new_client(chr, sioc); object_unref(OBJECT(sioc)); return ret;