From nobody Mon Feb 9 13:37:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681309522; cv=none; d=zohomail.com; s=zohoarc; b=TemFukZbfSOln9Zw9D+c3JXlzkugCSS4vdrt4dWNYHA4cRkGkatQRBuoYcdkHLbRWowIhBsifj+V3TZ/Ix+zX4xuqYkXPvh+BYhHSuLAdlpz62a/ZLkpJgLJDl9MvFeoHWLTz4AzzlCjeHWUyytRnbCUtKhvER9FazLzLBcTtds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681309522; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vFZ6kR2NGpy4WzT4tFoAWfHQ0z4cXJ7rLsZZMZMSXng=; b=lOqyM6qptRuzT8qSuxGoGvofN9PfZzj82rkXbLo2ZnBBgR0jDq0rVElOZs0+8n3OcniD0HWKsXT7+DmkacgOmmHjKAWv8gEAfIEtDekZz9dfMcEXouUl+tK+7NkkUlK1W8FZTvFvFgI7ZTaFab0fgr45pLwiM5Kt9IMM7PWsO+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1681309522907273.44218729084537; Wed, 12 Apr 2023 07:25:22 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-Mh4jd2JvPq6Rt-D0u35s2w-1; Wed, 12 Apr 2023 10:25:18 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37EDC855311; Wed, 12 Apr 2023 14:25:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF0C9492C13; Wed, 12 Apr 2023 14:25:14 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 23CDC1946A49; Wed, 12 Apr 2023 14:25:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3DA6D1946587 for ; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 202AB2027044; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id B1B6B2027043 for ; Wed, 12 Apr 2023 14:25:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681309522; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vFZ6kR2NGpy4WzT4tFoAWfHQ0z4cXJ7rLsZZMZMSXng=; b=CY4KUfgxDxxWumLgx7vymQxWaBUtbtvgzJ06V7ZrjuuHUOBw7Rw9cUH9L1We2F1dR9Oscu TKbgOLljiDH7aoQMcpkhHhX0TQC9/nPJD1a02pX2auuJ5hEy4aOh+xrbaN4vCwIPMMYmTg J/dIk4aazhTPyTZZg7vinBGD+Yf8EAk= X-MC-Unique: Mh4jd2JvPq6Rt-D0u35s2w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/5] qemuDomainChrInsertPreAlloced: Fix adding implicit console Date: Wed, 12 Apr 2023 16:25:06 +0200 Message-Id: <4d7a0abcca0ae5c52b1c555af2472a401dc6f359.1681307447.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681309524027100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When hotpluging a device, we might need to add a device with it (because of some crazy backcompat). Now, hotplugging is done in several phases. In one of them, qemuDomainChrPreInsert() allocates space for both devices, and then qemuDomainChrInsertPreAlloced() actually inserts the device into domain definition and sets up the device with it. Except, the condition that checks whether to create the aliased is wrong as it compares nconsoles against 0. Surprisingly, qemuDomainChrInsertPreAllocCleanup() doesn't suffer from the same error. Fixes: daf51be5f1b0f7b41c0813d43d6b66edfbe4f6d9 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3f45a48393..f517646c55 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1875,9 +1875,8 @@ qemuDomainChrInsertPreAlloced(virDomainDef *vmdef, virDomainChrDef *chr) { virDomainChrInsertPreAlloced(vmdef, chr); - if (vmdef->nserials =3D=3D 1 && vmdef->nconsoles =3D=3D 0 && + if (vmdef->nserials =3D=3D 1 && vmdef->nconsoles =3D=3D 1 && chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL) { - vmdef->nconsoles =3D 1; =20 /* Create an console alias for the serial port */ vmdef->consoles[0]->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONS= OLE; --=20 2.39.2