From nobody Sun Sep 28 17:12:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1757942713; cv=none; d=zohomail.com; s=zohoarc; b=VhECKv0GgpAtNdcE//sMGN44JZ0IEnl5/32p1Eeh5/q0weKkSfhibd7Lmg26sKYEp2B/89DZDHLW6PrxcjwPxv8EHoe+MOjTjmbuu9ixJNXXLnDh8SlocY7OSPrTykEhPjC74++AlqIvTfODgBxPD7vzSurpA5EQODHinB+eqro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757942713; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lL9NT3QdoPBXUIiDbTg52f0I3fPCeIR3oGxvpY7x4CI=; b=bLHloI5rTar/bz2CotrqVQGjTK6x+61HacBrXR5AuHSz78Nfjy5hHBy2TBqoptVvmZICrtTVbA4KnAQFfj5NPotEcf5mFaGtFe5EXIkGRtHvvgiPORpawtumh9eWhGiwqZlDq/zzwlp97+h5QMjPPW2J6/X6IxGR2lzTqJ1V4uI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757942713141286.32330553818326; Mon, 15 Sep 2025 06:25:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uy9AL-0001fy-5g; Mon, 15 Sep 2025 09:22:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uy9AE-0001c4-DR; Mon, 15 Sep 2025 09:22:38 -0400 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uy9A4-0006xa-B2; Mon, 15 Sep 2025 09:22:35 -0400 Received: from mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:cf2d:0:640:140f:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 622A8807BC; Mon, 15 Sep 2025 16:22:19 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:130::1:7]) by mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id GMPC4o1FuGk0-qOiAc6aL; Mon, 15 Sep 2025 16:22:19 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1757942539; bh=lL9NT3QdoPBXUIiDbTg52f0I3fPCeIR3oGxvpY7x4CI=; h=Cc:Message-ID:References:Date:In-Reply-To:Subject:To:From; b=PC+4cBukARcIOBo5Eja9VBhE5TPefubPqK4IdyPnVOA0Vo6VeYc3pazcwWu6Q9IH2 mjc2I7syiQWANVPeTHpk9JOe7nybU9q4FmIHGAF5L04Tdk+J88hzWqVabFD/s9SFFn L5wAEUWPy2SX5RaWX/PUXJup0xXVjHItc5t3Sb7Y= Authentication-Results: mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: berrange@redhat.com Cc: qemu-devel@nongnu.org, peterx@redhat.com, qemu-block@nongnu.org, vsementsov@yandex-team.ru, leiyang@redhat.com, marcandre.lureau@redhat.com, Paolo Bonzini Subject: [PATCH v3 02/13] char-socket: tcp_chr_recv(): add comment Date: Mon, 15 Sep 2025 16:21:59 +0300 Message-ID: <20250915132211.135095-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250915132211.135095-1-vsementsov@yandex-team.ru> References: <20250915132211.135095-1-vsementsov@yandex-team.ru> 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=2a02:6b8:c41:1300:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1757942715925116600 Add comment, to stress that the order of operation (first drop old fds, second check read status) is intended. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- chardev/char-socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index b1ce5d01c7..1be078dfc0 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -294,7 +294,12 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, s= ize_t len) } =20 if (msgfds_num) { - /* close and clean read_msgfds */ + /* + * Close and clean previous read_msgfds, they are obsolete at + * this point, regardless result of new call to + * qio_channel_readv_full(). + */ + for (i =3D 0; i < s->read_msgfds_num; i++) { close(s->read_msgfds[i]); } --=20 2.48.1