From nobody Sun Feb 8 11:16:54 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1605541274; cv=none; d=zohomail.com; s=zohoarc; b=L9aMCqnGq5dxzIisq3YjkwqMeolDqTWVJ5AnMyUtvQwTZSXPMVCk64/xIyDbr75vRfY/GZkwZep5QldKOeIMY492bpN/bghy3yFXX/R312eku4Gmf/4seUEpt4YzgXl5jTYgA0O/BnyE1Gv9BhMDnpNHoBCXghJ4g/JJ0vX+pus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605541274; 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=19JFcMC2qAjD3oMoSCB9QIlkLdqfZ31pLynNmX9F/ko=; b=aFoqVpW14sZKOeIY/BTpaZLbChv+c7WNoTaqIZDDmkJZAGPJAHWV0rj1gejZMW6bEFk6jmoEPM5Dvw/SSpQeA+NR90ZX/O8yP34rVcSvkjJyU56ygaDSQPAshwjRzB0n8ZmctQbycCz4r+IMytb09Cd8DbpN1SfIM4api9RFR0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1605541274137755.6828655139154; Mon, 16 Nov 2020 07:41:14 -0800 (PST) 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-407-kEkYgRLQP1OLEYbkR2KDPg-1; Mon, 16 Nov 2020 10:39:52 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1476A106B309; Mon, 16 Nov 2020 15:39:37 +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 DE5D75C5B7; Mon, 16 Nov 2020 15:39:36 +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 A55B1183D025; Mon, 16 Nov 2020 15:39:36 +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 0AGFd4A6022532 for ; Mon, 16 Nov 2020 10:39:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id D7C646EF55; Mon, 16 Nov 2020 15:39:04 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.193.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54BC86EF51 for ; Mon, 16 Nov 2020 15:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605541273; 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=19JFcMC2qAjD3oMoSCB9QIlkLdqfZ31pLynNmX9F/ko=; b=ERcdfMWynvsck6pd1WElhwqlFxiGnPHz4OvEhUZPZ8ywqLZtIUjb7p2GpA1y79nqAnI+jO fgTEJhV4w4Iy8mJ7Nr4WFx5z2aidi/SE2tM5TYOaBOoEPEMnCQpRUiGCeYpuHIrk+VECNQ r3sB/Irs2EQPPvnydUZYGLEc1T0/wR8= X-MC-Unique: kEkYgRLQP1OLEYbkR2KDPg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 02/11] domain_conf: fix NULL dereference on error in virDomainObjCopyPersistentDef Date: Mon, 16 Nov 2020 16:38:49 +0100 Message-Id: <62ca001eb2c96ec894770da13b353a978bc6436a.1605541084.git.phrdina@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.16 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) Content-Type: text/plain; charset="utf-8" The issue was introduced together with the function itself by commit . Calling `virDomainObjGetPersistentDef` may return NULL which is later passed to `virDomainDefFormat` where the `def` attribute is marked as NONNULL and later in `virDomainDefFormatInternalSetRootName` it is actually defererenced without any other check. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c30227212..eaad72ad0a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30933,6 +30933,12 @@ virDomainObjCopyPersistentDef(virDomainObjPtr dom, virDomainDefPtr cur; =20 cur =3D virDomainObjGetPersistentDef(xmlopt, dom, parseOpaque); + if (!cur) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Get persistent config failed")); + return NULL; + } + return virDomainDefCopy(cur, xmlopt, parseOpaque, false); } =20 --=20 2.26.2