From nobody Sun May 5 03:58:33 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=1634543939; cv=none; d=zohomail.com; s=zohoarc; b=gLuFv5aMeLUb/5cmdiOl8FGOLDrDrTbYLRYEsYcnwLue3S967+MY9AAPSVNfZ5YUAXwD0XoCbNXQ1pQ4W9xfUIOmYRqNFaa24t/NUYSsfJ0Pb9aFk+lr4/KNkRzHCeINXWbW2Gw9pN6Ee0/iyeTYxxsHKTWZdaxgZ5Rcba0/NXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634543939; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=VI9YDCmWfOlUlxcV2IR24MXJlXqerf/JvFO9bAWma3Y=; b=m/PvMz/W6iPaDPa79Gay85XoIH0TWok5pyOcRgHCy0wKOR4ODZVJhOyIILu4evCWuBjCmfkY+rWnFaZ2QpYi8nMlFSNxn0R0qyFQfAg+d1h7+vv88Wpyo3mPjFqB+i0+W2C6F5El/Z8FJzjqpwb52FwRVtYYrGGJ0JLQOnwaleE= 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 1634543939973289.2399128904335; Mon, 18 Oct 2021 00:58:59 -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-358-UvjU_0ONOd2TkgfKevb8tw-1; Mon, 18 Oct 2021 03:58:55 -0400 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 8B4AC1006AA8; Mon, 18 Oct 2021 07:58:50 +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 F2CB8B8540; Mon, 18 Oct 2021 07:58:49 +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 3D3CC4A703; Mon, 18 Oct 2021 07:58:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19I7wkM9020114 for ; Mon, 18 Oct 2021 03:58:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id C4B83B854E; Mon, 18 Oct 2021 07:58:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ED2DB854D for ; Mon, 18 Oct 2021 07:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634543938; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VI9YDCmWfOlUlxcV2IR24MXJlXqerf/JvFO9bAWma3Y=; b=fJf/Nytq/RL5AfiuS+7Waz05VH+g5hmky6qsQ6ds2mq7mRWNZV1osIcpgWbCHrfw0TubCP BKtUM/vbw69KdgxwZQrp/CONYqGzm4KsRNynSAhu8t7qm818QkyBya/Mo86dnct5w8jWWM Zy+nzea9tD5O7l8rH3j/JeTm/O3tBaY= X-MC-Unique: UvjU_0ONOd2TkgfKevb8tw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] virNodeDeviceDefParse: Don't call post-parse callbacks with NULL def Date: Mon, 18 Oct 2021 09:58:40 +0200 Message-Id: <8cf51af89d7c1deb5931cb4367f448bfffb33588.1634543920.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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) X-ZM-MESSAGEID: 1634543940978100003 Content-Type: text/plain; charset="utf-8" When parsing of the node device XML we'd still call the post-parse and validation callbacks which makes no sense. Additionally the callbacks were expecting a non-NULL pointer which leads to a crash. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2014139 Fixes: d5ae634ba28 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 9bbff97ffd..d5e02f623d 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2178,8 +2178,9 @@ virNodeDeviceDefParse(const char *str, g_autoptr(virNodeDeviceDef) def =3D NULL; if ((xml =3D virXMLParse(filename, str, _("(node_device_definition)"),= NULL, false))) { - def =3D virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(xml), - create, virt_type); + if (!(def =3D virNodeDeviceDefParseNode(xml, xmlDocGetRootElement(= xml), + create, virt_type))) + return NULL; } if (parserCallbacks) { --=20 2.31.1