From nobody Mon Feb 9 03:16:12 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=1678094444; cv=none; d=zohomail.com; s=zohoarc; b=QrPPqxudu8eG4aa8xBMO+3c57QbTxLHYdiEYii1cKPKLiPrwKSrQOyc5H2tT4c5p1JMcar3A2StITp+hItB8ac2LFJ1O/KL9SM2izxDqP6bW4anu33+ObzNw6/XZhKkCra+7ruufJqwqaC9sRGcoqq+IDrGQrr156GqvwvWgNPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094444; 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=KmcQb9vO0+MjCJ1y/3QgutvXYu5Ja4iI4ZJqZIQWwN0=; b=eXU9qb0b8YJfWxbBGoL64uxCKk2Ud5jjlfLPfiXoFAwH1HBOuq7JHjKLaSB/jUaTH+0I/PFDsoll8Ess0zMEEMU7It1Y1RE+Tgt/TsOAbto7n0s6fXhBs+J/z1zOrT9D2equMVTDOJ/3hKH2kVBn4TNYAcN0+Of1iKRRcO4npZc= 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 1678094444876572.7225420482256; Mon, 6 Mar 2023 01:20:44 -0800 (PST) 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-214-xa1B3e4yNJyvRAcYH04YLw-1; Mon, 06 Mar 2023 04:20:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97AC2857AA2; Mon, 6 Mar 2023 09:20:39 +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 8489BC16029; Mon, 6 Mar 2023 09:20:39 +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 658BC194658C; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1D9B61946586 for ; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 10D75112132D; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8582D1121314 for ; Mon, 6 Mar 2023 09:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094443; 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=KmcQb9vO0+MjCJ1y/3QgutvXYu5Ja4iI4ZJqZIQWwN0=; b=Fv81enVT74gNZfSqCu/DMtcu0YYJ23Rbp0+dwFCIlG7LJxsMBryzVD3FHSZOTMQtU3sDh3 ZSM0lKvKFg2c+f5th+UGmOrbsuqmbe6SX9gVACbHz3/0QdLsRxQLyAKH7ukduO3Vlsp2zi 0W6/OUSetbolkhTQG46VmvItfisSv/c= X-MC-Unique: xa1B3e4yNJyvRAcYH04YLw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] qemuBuildHostNetProps: Report proper errors for unhandled interface types Date: Mon, 6 Mar 2023 10:20:30 +0100 Message-Id: <61909b67562f174a5409af64d1091ced93758cb8.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.8 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: 1678094446362100002 Content-Type: text/plain; charset="utf-8" VIR_DOMAIN_NET_TYPE_NULL and VIR_DOMAIN_NET_TYPE_VDS are not implemented for the qemu driver but the formatter code in 'qemuBuildHostNetProps' didn't report an error for them and didn't even return from the function when they were encountered. This caused a crash in 'virJSONValueObjectAppendStringPrintf' which does not tolerate NULL JSON object to append to when the unsupported devices were used. Properly report error when unhandled devices are encountered. This also includes the case for VIR_DOMAIN_NET_TYPE_HOSTDEV, but that code path should never be reached. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2175582 Fixes: 6457619d186 Fixes: 0225483adce Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4839d45a34..589ec3e639 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3995,8 +3995,14 @@ qemuBuildHostNetProps(virDomainObj *vm, /* Should have been handled earlier via PCI/USB hotplug code. */ case VIR_DOMAIN_NET_TYPE_NULL: case VIR_DOMAIN_NET_TYPE_VDS: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("network device type '%s' is not supported by thi= s hypervisor"), + virDomainNetTypeToString(netType)); + return NULL; + case VIR_DOMAIN_NET_TYPE_LAST: - break; + virReportEnumRangeError(virDomainNetType, netType); + return NULL; } if (virJSONValueObjectAppendStringPrintf(netprops, "id", "host%s", net= ->info.alias) < 0) --=20 2.39.2