From nobody Sat May 4 05:16:40 2024 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=1639661275; cv=none; d=zohomail.com; s=zohoarc; b=F6bbQt1nZngooJEPO24y5qOub0yKI6y+I4OLR9KDJc1wo1HmCsNay/pOyVRx+V8uAUX7OmBXbqh1YS3s9c3vk4PXeG9OsBUp+ORf5DQtvGAFLuH8MMAOj5MXA+upH6Bz0c35qDSELPiFjfXHDzjvT6VwRSs63GatzdAQzPDCQ4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639661275; 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=F049h1rzcWHfLGP0nD7EtVw1m2bgThtAMHLdcOVDKE4=; b=BxoyzaYIY0mR1i9gDhM+AHq/KepBH8BL/MmZhOoBjwiL+gXpldFzTxJc0b6pa+2/S1JhzDVxD9k3tOKrBSIwcpO82lDpv4rnV1HUXiW/4ds65hjezp5HKpDG9ATCv+B0yb0nTiMRWLK/jv0XQ4zb2l97oQFe9FBVEXSBFCiYNYo= 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 1639661275466107.02792830271278; Thu, 16 Dec 2021 05:27:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-CpO5jc2BO7aS3rvj9Rcv8A-1; Thu, 16 Dec 2021 08:27:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B1288015CD; Thu, 16 Dec 2021 13:27:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 984345BE21; Thu, 16 Dec 2021 13:27:47 +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 24D751809CB8; Thu, 16 Dec 2021 13:27:47 +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 1BGDMbLI023583 for ; Thu, 16 Dec 2021 08:22:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id D32E84E2C7; Thu, 16 Dec 2021 13:22:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35B2B5E4B9 for ; Thu, 16 Dec 2021 13:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639661274; 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=F049h1rzcWHfLGP0nD7EtVw1m2bgThtAMHLdcOVDKE4=; b=NuaLvphut9cp9+NZJbNYQVrFJcNbRfjQcVnDeNTWi6Vs7moiGKHJSCDDNT3KmNletO6wNA 2KsUI0yWQcAoQZbbGr1KMk0S6L5qdnOpVoWvq901yKhwh31kmkuIpta2uJxYjFcqRXQu32 4rbgLQ7sYZsSJpwjCigy3Zeu11Hy7gM= X-MC-Unique: CpO5jc2BO7aS3rvj9Rcv8A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] virDomainDiskInsert: Don't access NULL disk target Date: Thu, 16 Dec 2021 14:22:19 +0100 Message-Id: <2c334701c30483fb9715910f04290f5975c5ee01.1639660896.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1639661277112100001 Content-Type: text/plain; charset="utf-8" 'virDomainDiskInsert' orders the inserted disks by target. If the target is not provided though it would try to parse it anyways. This lead to a crash when parsing a definition where there are multiple disks and of two disks sharing the bus at least one also misses the target. Since we want to actually use the parser for stuff which doesn't necessarily need the disk target, we make virDomainDiskInsert tolerant of missing target instead. The definition will be rejected by the validator regardless of the order the disks were inserted in. Fixes: 61fd7174 Closes: https://gitlab.com/libvirt/libvirt/-/issues/257 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9a21ac10ce..e0c92816f1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15653,6 +15653,7 @@ void virDomainDiskInsert(virDomainDef *def, /* If bus matches and current disk is after * new disk, then new disk should go here */ if (def->disks[idx]->bus =3D=3D disk->bus && + def->disks[idx]->dst && disk->dst && (virDiskNameToIndex(def->disks[idx]->dst) > virDiskNameToIndex(disk->dst))) { insertAt =3D idx; --=20 2.31.1 From nobody Sat May 4 05:16:40 2024 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=1639661237; cv=none; d=zohomail.com; s=zohoarc; b=JSnZQiuSuyQ3Liy4DlcMuTBwHg/P133uVBS040mFnAjQDq9irLw0UQC3MBlznxqd57fg9Io8aK+ZMmh8LCNhweEAJSJCe/2lroRQtbzoXgqDLiHe1pCS+UOozkIszzkpe46FJfHNPhEkMf2fJzZr2W9qBgyZkRDETsxZgmr1J3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639661237; 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=sIrJVjRIlktfzxSeqnWmDf2GU/qqwTgJf8s9VoQ25YU=; b=CHTnr8EgobX+X6Fv1lloec8EZs3IDRpYyf13WwwahaAaAVY0nnUSQtVegpwYtOAZLbKk0oMtk+eLlLbgadkmbbqzC3qst1IxrDK83TD6KQgUVjI+CEWkipvQFUemvTObtdeSY/av7Za7Pn14IEN5x9/sSU3BhXombILmJAoIDgk= 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 1639661236993713.4927591363919; Thu, 16 Dec 2021 05:27:16 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-dm8ZRhuiNm2mebxAm7Kvxg-1; Thu, 16 Dec 2021 08:27:14 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F2E11015DA6; Thu, 16 Dec 2021 13:27:07 +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 F2BE5101F6CF; Thu, 16 Dec 2021 13:27:05 +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 185D04BB7C; Thu, 16 Dec 2021 13:27:01 +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 1BGDMb8o023591 for ; Thu, 16 Dec 2021 08:22:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 44BEC4E2C5; Thu, 16 Dec 2021 13:22:37 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42ABD5E4B2 for ; Thu, 16 Dec 2021 13:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639661236; 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=sIrJVjRIlktfzxSeqnWmDf2GU/qqwTgJf8s9VoQ25YU=; b=KougF+6xKrl3/lsuoNjnsMRu2GJOECo9exI0HAEMeRPVTSCbHWpQmNZIayfocBjYtj/BVg j9oYCONsaH5p0ai6FFth+xi/J/EMdwnyberG8dEimR0MvmgHLwROc0j4OPQoCBisuSH4i3 UVTWE7KQdLInsRea3z9JqIIAsPdHVhM= X-MC-Unique: dm8ZRhuiNm2mebxAm7Kvxg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuxml2argvtest: disk-missing-target: Add two disks with same bus Date: Thu, 16 Dec 2021 14:22:20 +0100 Message-Id: <9284186375f716f41a5bcad3c2d4bd2710ffe820.1639660896.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1639661237345100001 Content-Type: text/plain; charset="utf-8" A recent code movement introduced a bug which reproduces only when there are two disks on the same bus missing the target. Improve the test case for the missing target test. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemuxml2argvdata/disk-missing-target-invalid.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemuxml2argvdata/disk-missing-target-invalid.xml b/tests= /qemuxml2argvdata/disk-missing-target-invalid.xml index 49cd73142a..11287f2afb 100644 --- a/tests/qemuxml2argvdata/disk-missing-target-invalid.xml +++ b/tests/qemuxml2argvdata/disk-missing-target-invalid.xml @@ -17,6 +17,9 @@ + + + --=20 2.31.1