From nobody Fri May 17 06:07:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1622060400; cv=none; d=zohomail.com; s=zohoarc; b=eOao+VigMmlEbU2pgpp8M57X+HaiWgEToAGT9a8n1c8ry1+mKGHC39YdaEG9LSeDqeAHhEcqYoh6cwqW0QSEkMNC9mu+N92CHnfAfe0eW/V+wlkvIKoi+VoJg1hb55Ca3Osy2JHsFR5pLCLjVn9px5pxifiA0o+GEqq14A7jFuA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622060400; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=CqKy2GDiG3AuNHSllXEO1zVGOXADddtz0Fptfvpek0Y=; b=nfNYVou5xgoMubOT5/uvaM1Sz9xsZeTJ/ri+T3CFQxQv364DWQOLvkyhGKc6CoZeReUn+Upg7C2MyDBuDR6uvas5sWGL1WQZskbF+0i8bqWSn5YKwnpKTLRO4ENQ/n3gHrFUAHidowm3ZlaHV2jRPTrTcdrltj7uGfOjtlniDXo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 162206040072983.78783198121312; Wed, 26 May 2021 13:20:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-eq_QDi4hOFuS9fDwxwXlBg-1; Wed, 26 May 2021 16:19:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A8FB802575; Wed, 26 May 2021 20:19:49 +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 E1FE660C5A; Wed, 26 May 2021 20:19:48 +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 018DF180102A; Wed, 26 May 2021 20:19:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14QKJkoA004470 for ; Wed, 26 May 2021 16:19:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 673F3208097F; Wed, 26 May 2021 20:19:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 62F55207B37A for ; Wed, 26 May 2021 20:19:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 093BC8CACC2 for ; Wed, 26 May 2021 20:19:43 +0000 (UTC) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-85--He4yl6QMsWko-TFKyxORw-1; Wed, 26 May 2021 16:19:40 -0400 Received: by mail-qk1-f174.google.com with SMTP id v8so2426438qkv.1 for ; Wed, 26 May 2021 13:19:40 -0700 (PDT) Received: from localhost (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id z18sm2229371qki.55.2021.05.26.13.19.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 May 2021 13:19:39 -0700 (PDT) X-MC-Unique: eq_QDi4hOFuS9fDwxwXlBg-1 X-MC-Unique: -He4yl6QMsWko-TFKyxORw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CqKy2GDiG3AuNHSllXEO1zVGOXADddtz0Fptfvpek0Y=; b=KGQlbZRqQolVQNNCQsbhiHzQtOl7wOCh5IqNxs/Qm6/0HA3zAyiWxHJZyO2B9pA9dT B5egHnX2B0nLcEuv1x2IN2llCMewHEcUTYE5XDUtVi8+PjlK7JAaAxYZn3jHwjfYg18l xXcpLxjne1n5N/EfXgSNLUyWysaE6rxKpB5Oa/b/3ZwHBkUfzjo2O7Qf6M+faD5HEtg1 NjAWCnxPR2qb8q5KAIK/OeWm6ZMN5N0YADhNEeFAq2+fzjtFGM3RD3cOiKnEhZbaaWpe 7hfekz1MTwCtIgwhMC+dyi8/IuR0D05lVYEGmBqOIX9dUOP3LkDoAu8ggGYKJT8x8717 m/FA== X-Gm-Message-State: AOAM532YO0mY4hQviwgapNEI4Sh44OsV3VZZLe0c5ZEBCDDUxVfO2IM2 3VyLVl5YYQlriz44U+GVtanOYfKC4A== X-Google-Smtp-Source: ABdhPJyGcTWGDrjvbRtrX8O6iKonoKxhykY8LINi8mn9TBvb264Lj5I3k6yHHuRTadaQDyn4HXZsUw== X-Received: by 2002:a05:620a:1678:: with SMTP id d24mr40738303qko.317.1622060379917; Wed, 26 May 2021 13:19:39 -0700 (PDT) From: Masayoshi Mizuma To: libvir-list@redhat.com Subject: [PATCH] qemuDomainAttachDiskGenericTransient: Add NULL check in case the overlay disk already exists Date: Wed, 26 May 2021 16:19:22 -0400 Message-Id: <20210526201922.460819-1-msys.mizuma@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Masayoshi Mizuma , Masayoshi Mizuma 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.13 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 Content-Type: text/plain; charset="utf-8" From: Masayoshi Mizuma When is set to a disk and the overlay disk already exists because of something abnormal, libvirt is terminated by Segmentation fault. # virsh start Test0 error: Disconnected from qemu:///system due to end of file error: Failed to start domain 'Test0' error: End of file while reading data: Input/output error Add NULL check for snapdiskdef so that the rollback can work correctly. Signed-off-by: Masayoshi Mizuma Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9ff6175dd3..0640cdd9f7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -695,7 +695,9 @@ qemuDomainAttachDiskGenericTransient(virDomainObj *vm, g_autoptr(qemuSnapshotDiskContext) snapctxt =3D NULL; g_autoptr(virDomainSnapshotDiskDef) snapdiskdef =3D NULL; =20 - snapdiskdef =3D qemuSnapshotGetTransientDiskDef(disk, vm->def->name); + if (!(snapdiskdef =3D qemuSnapshotGetTransientDiskDef(disk, vm->def->n= ame))) + return NULL; + snapctxt =3D qemuSnapshotDiskContextNew(1, vm, asyncJob); =20 if (qemuSnapshotDiskPrepareOne(snapctxt, disk, snapdiskdef, --=20 2.27.0