From nobody Mon Feb 9 22:59:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1681309528; cv=none; d=zohomail.com; s=zohoarc; b=l326RY2UplX0x4mryBvv8ittYrlOjeBP3UbxuQdM/zVo8q90sIgLnHjnHt261TRlBFUkNm4Sm9UMSzuSVRO2wYTh28eZ6IEj7K0CQSdlNQs0aUJMU/mDaQF7FDYS8N8sXl0qAjA48a7UBtIIz6y8el6o4ZdwalQ1e7dMsnCzv1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681309528; 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=8lNOxe9Y3zGEF/V3UFri8pY/UvDpMlAoPYb4oLpCYeI=; b=h9NCl290ukRnqBJQCn48If9iAe2znUbyNQN23yuodhgGW2nhAuC69uTQZ3ghL8198E0+/vqty1esIU3mBCAAebGiJzmU/bBhZWX9y5pfwNMvI3ztQnHm8PQw+Hg+yL30FOQ8KdD1GOGOGoznWp9NLmpq+s6TPJ5Xatmjt+BfBy0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1681309528107939.7766883917127; Wed, 12 Apr 2023 07:25:28 -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-600-ouUtqdtzM6-_zZE6n5GV6Q-1; Wed, 12 Apr 2023 10:25:19 -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 DB56285531A; 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 C5413492C13; Wed, 12 Apr 2023 14:25:15 +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 A186C1946595; Wed, 12 Apr 2023 14:25:15 +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 C1C251946597 for ; Wed, 12 Apr 2023 14:25:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A67D82027045; Wed, 12 Apr 2023 14:25:14 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A7AD2027043 for ; Wed, 12 Apr 2023 14:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681309527; 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=8lNOxe9Y3zGEF/V3UFri8pY/UvDpMlAoPYb4oLpCYeI=; b=JNwwVMdxKzUR2MVGSnJNQwHX/ub9zlt5IuXyf2lNtUz31l4mU7RCxAu0sQGoRis6iE6yfO 0Zrs6hOrHxbqR1RQECPcg4p0NiTsntYnkMczwoM4Pqmq4iUmlj2teKg5R+1wvzczqbrEsz NlsBShiN9Q61C0jEJdFQnktDmIffv04= X-MC-Unique: ouUtqdtzM6-_zZE6n5GV6Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/5] qemuAssignDeviceChrAlias: Fix a crasher during hotplug Date: Wed, 12 Apr 2023 16:25:08 +0200 Message-Id: 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: 1681309529981100001 Content-Type: text/plain; charset="utf-8"; x-default="true" For a running guest, a device can be hotunplugged. This will then remove also aliased . Trying to hotplug a device then, libvirtd crashed because it dereferences def->consoles while there's none. Fixes: 42d53ac799a1d7f1414737caa4deb73871876992 Signed-off-by: Michal Privoznik --- src/qemu/qemu_alias.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 85db7fbfe3..161d30cf72 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -95,6 +95,7 @@ qemuAssignDeviceChrAlias(virDomainDef *def, if (chr->deviceType =3D=3D VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE && chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL && def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM && + def->nconsoles && def->consoles[0] =3D=3D chr && def->nserials && def->serials[0]->info.alias) { --=20 2.39.2