From nobody Mon Feb 9 23:00:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529373277245663.3668738516118; Mon, 18 Jun 2018 18:54:37 -0700 (PDT) Received: from localhost ([::1]:38411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5qu-0007ty-Eg for importer@patchew.org; Mon, 18 Jun 2018 21:54:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5gv-0000NL-6P for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:44:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5gr-0007mN-Rt for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:44:17 -0400 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:32789) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5gr-0007mD-Mw; Mon, 18 Jun 2018 21:44:13 -0400 Received: by mail-oi0-x236.google.com with SMTP id c6-v6so16697455oiy.0; Mon, 18 Jun 2018 18:44:13 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id j196-v6sm8555820oib.14.2018.06.18.18.44.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EIAT/+j1IAUdid27m8DLYdTKwpr61SdqpbrScpRchms=; b=iAmnaNnh+tKi93naPYflO56dV0G5QOM+DkGnnypCAI2Z62HAsQRPQsgv0mkW0iE4ol OUiYLKCkkTpdFPBmv+s4YuXEq2x5OQc4Y7dw/ZGCnjVqippwZFnzPgmPHk8iUQPknE21 Fj4PPMDeyw1Zp4X41OwLHE7RVYbq3kHrvvvI0KWS/clVFF6xqDdGwm+xg3rnT0OjWfM+ pm5dH7lyiDVGyOQH5ymwO49DfPNYienzn7YT+Cfm1qv9Rn7ONu0lPwt8++ccBaqtBDG6 fGSK/P8jsXcsmF+fjIIdtCzY4R/Wd+rcvQh/7VIEvqLwu7x6aBhYIEBfceS3GhwENmSQ A5lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=EIAT/+j1IAUdid27m8DLYdTKwpr61SdqpbrScpRchms=; b=NY7cZv2hGbnfydn5bQK3L13f+7NbPybypkmZlTkiuQdrlFd+ycmwYUd8gCEXQNJ1k9 IV0DmWyQx6x56ILt2bd7wBG/YoGuDeVmq84wVwRSQ9r6chNY1hEgThBVmpP+Oj1Qzgno AiexmZvBZPtY+2FYE4bGGw+jg1h23IfuEOgTUneh9BUvADGSuKA/HsSWHMjhjTx5fivU XFQzIJR8MsZc2/51ekmuSwu865BLSpomMFbVUTiJw9qVoEMsf52/6PtmGELBA1x9RiZj VtHgqV9zCgd/T0aKuKjtX+9tW3YU+mq8gkRVFzSIEGzgT2PHgMF2WXDj1cdkRyVeCZVa gmbA== X-Gm-Message-State: APt69E1b3rQF3R8/JhQoQGJi3Wlz8l+666WrisgT7GRf8n1cF5fl+Dla w7kqHpT4pCPjTNGMUZmWtkrwld/S X-Google-Smtp-Source: ADUXVKJQlzScApYtsfAVTfhGwsJuMp9tK7vuSpcy3kcIGnJ+bQUYBwcVZ/d+Egsi9iJHub3zK761Sg== X-Received: by 2002:aca:49c4:: with SMTP id w187-v6mr8752199oia.123.1529372652393; Mon, 18 Jun 2018 18:44:12 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:43:16 -0500 Message-Id: <20180619014319.28272-111-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::236 Subject: [Qemu-devel] [PATCH 110/113] vhost-user: delete net client if necessary X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linzhecheng , Jason Wang , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: linzhecheng As qemu_new_net_client create new ncs but error happens later, ncs will be left in global net_clients list and we can't use them any more, so we need to cleanup them. Cc: qemu-stable@nongnu.org Signed-off-by: linzhecheng Signed-off-by: Jason Wang (cherry picked from commit c67daf4a24442d1bb404a11a6a54dc45ea10f234) Conflicts: net/vhost-user.c * drop functional dep on 4d0cf552 Signed-off-by: Michael Roth --- net/vhost-user.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index c23927c912..d2015e30b6 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -296,7 +296,7 @@ static int net_vhost_user_init(NetClientState *peer, co= nst char *device, s =3D DO_UPCAST(VhostUserState, nc, nc); if (!qemu_chr_fe_init(&s->chr, chr, &err)) { error_report_err(err); - return -1; + goto err; } } =20 @@ -306,7 +306,7 @@ static int net_vhost_user_init(NetClientState *peer, co= nst char *device, do { if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) { error_report_err(err); - return -1; + goto err; } qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event, NULL, nc0->name, NU= LL, @@ -316,6 +316,13 @@ static int net_vhost_user_init(NetClientState *peer, c= onst char *device, assert(s->vhost_net); =20 return 0; + +err: + if (nc0) { + qemu_del_net_client(nc0); + } + + return -1; } =20 static Chardev *net_vhost_claim_chardev( --=20 2.11.0