From nobody Mon Apr 29 12:40:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513770587756467.1758330774304; Wed, 20 Dec 2017 03:49:47 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F4FD4E906; Wed, 20 Dec 2017 11:49:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E771A226F7; Wed, 20 Dec 2017 11:49:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B10B94BB79; Wed, 20 Dec 2017 11:49:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBKBni4a012130 for ; Wed, 20 Dec 2017 06:49:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id D8EAA190DB; Wed, 20 Dec 2017 11:49:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-111.phx2.redhat.com [10.3.117.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1E25226F0 for ; Wed, 20 Dec 2017 11:49:42 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 20 Dec 2017 06:49:41 -0500 Message-Id: <20171220114941.25538-1-jferlan@redhat.com> In-Reply-To: <20171220000137.22529-1-jferlan@redhat.com> References: <20171220000137.22529-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2/1] qemu: Move TCP and haveTLS checks into qemuDomainDelChardevTLSObjects X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 20 Dec 2017 11:49:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similar to qemuDomainAddChardevTLSObjects let's move the chardev source must be TCP and it has the @haveTLS flag set checks before trying to delete the TLS objects. For the Chr device this represents no change; however, for RNG device this is an additionaly check that was missed in commit id '68808516'. Before adding the objects, TCP and haveTLS are checked. Signed-off-by: John Ferlan Reviewed-by: Chen Hanxiao --- Thanks for the review... Of course after re-reading my own patch "in the morning" I realized I could/should have taken the next step to check the chardev source for TCP and haveTLS being set similar to how the Add code does things. So that's what this patch does. src/qemu/qemu_hotplug.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 85f47bee2..b79807300 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1565,6 +1565,7 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn, static int qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver, virDomainObjPtr vm, + virDomainChrSourceDefPtr dev, const char *inAlias) { int ret =3D -1; @@ -1573,6 +1574,12 @@ qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driv= er, char *tlsAlias =3D NULL; char *secAlias =3D NULL; =20 + if (dev->type !=3D VIR_DOMAIN_CHR_TYPE_TCP || + dev->data.tcp.haveTLS !=3D VIR_TRISTATE_BOOL_YES) { + ret =3D 0; + goto cleanup; + } + if (!(tlsAlias =3D qemuAliasTLSObjFromSrcAlias(inAlias))) goto cleanup; =20 @@ -4178,10 +4185,8 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; =20 - if (chr->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_TCP && - chr->source->data.tcp.haveTLS =3D=3D VIR_TRISTATE_BOOL_YES && - rc =3D=3D 0 && - qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0) + if (rc =3D=3D 0 && + qemuDomainDelChardevTLSObjects(driver, vm, chr->source, charAlias)= < 0) goto cleanup; =20 virDomainAuditChardev(vm, chr, NULL, "detach", rc =3D=3D 0); @@ -4243,7 +4248,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver, =20 if (rng->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD && rc =3D=3D 0 && - qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0) + qemuDomainDelChardevTLSObjects(driver, vm, rng->source.chardev, + charAlias) < 0) goto cleanup; =20 virDomainAuditRNG(vm, rng, NULL, "detach", rc =3D=3D 0); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list