From nobody Sat Feb 7 13:48:05 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543930781068434.13859421685277; Tue, 4 Dec 2018 05:39:41 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C2BB3082130; Tue, 4 Dec 2018 13:39:39 +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 6A3C882799; Tue, 4 Dec 2018 13:39:38 +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 AAE914EA3C; Tue, 4 Dec 2018 13:39:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB4DdZr0021714 for ; Tue, 4 Dec 2018 08:39:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 12280784A6; Tue, 4 Dec 2018 13:39:35 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D9C8709E8 for ; Tue, 4 Dec 2018 13:39:34 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 4 Dec 2018 14:39:29 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemuBuildRNGBackendChrdevStr: Fix formatting 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 04 Dec 2018 13:39:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The way that the code is currently written makes my eyes hurt. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b7a548c68c..32ed83f277 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5763,10 +5763,12 @@ qemuBuildRNGBackendChrdevStr(virLogManagerPtr logMa= nager, { unsigned int cdevflags =3D QEMU_BUILD_CHARDEV_TCP_NOWAIT | QEMU_BUILD_CHARDEV_UNIX_FD_PASS; - if (chardevStdioLogd) - cdevflags |=3D QEMU_BUILD_CHARDEV_FILE_LOGD; + *chr =3D NULL; =20 + if (chardevStdioLogd) + cdevflags |=3D QEMU_BUILD_CHARDEV_FILE_LOGD; + switch ((virDomainRNGBackend) rng->backend) { case VIR_DOMAIN_RNG_BACKEND_RANDOM: case VIR_DOMAIN_RNG_BACKEND_LAST: --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Feb 7 13:48:05 2026 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543930781839157.1939090343842; Tue, 4 Dec 2018 05:39:41 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC15F308A953; Tue, 4 Dec 2018 13:39:39 +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 73AD25C23E; Tue, 4 Dec 2018 13:39:39 +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 80ED54EA3B; Tue, 4 Dec 2018 13:39:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB4DdZS9021723 for ; Tue, 4 Dec 2018 08:39:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id D7596827AE; Tue, 4 Dec 2018 13:39:35 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E645709E8 for ; Tue, 4 Dec 2018 13:39:35 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 4 Dec 2018 14:39:30 +0100 Message-Id: <33f71e006ce5c614a19403a1cbf2903698b2a462.1543930755.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemuDomainRemoveRNGDevice: Remove associated chardev too 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 04 Dec 2018 13:39:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1656014 An RNG device can consists of more devices than RND device itself. For instance, in case of EGD there is a chardev that connects to EGD daemon and feeds the qemu with random data. When doing RNG device removal we have to remove the associated chardev as well. At the same time, we should not do any 'goto cleanup' until virDomainAuditRNG() is called as it might result in us not propagating the audit message. Signed-off-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5f756b7267..f1526bbd1b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4831,13 +4831,24 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver, rc =3D qemuMonitorDelObject(priv->mon, objAlias); =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + rc =3D -1; =20 - if (rng->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD && - rc =3D=3D 0 && - qemuDomainDelChardevTLSObjects(driver, vm, rng->source.chardev, - charAlias) < 0) - goto cleanup; + if (rng->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD) { + if (rc =3D=3D 0 && + qemuDomainDelChardevTLSObjects(driver, vm, rng->source.chardev, + charAlias) < 0) + rc =3D -1; + + if (rc =3D=3D 0) { + qemuDomainObjEnterMonitor(driver, vm); + + if (qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) + rc =3D -1; + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + rc =3D -1; + } + } =20 virDomainAuditRNG(vm, rng, NULL, "detach", rc =3D=3D 0); =20 --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list