From nobody Thu Sep 19 01:04:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1717080864432487.6803085718519; Thu, 30 May 2024 07:54:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 44DA81A38; Thu, 30 May 2024 10:54:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1B4211C1E; Thu, 30 May 2024 10:51:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EE1EA1BA9; Thu, 30 May 2024 10:51:20 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 990B11A23 for ; Thu, 30 May 2024 10:51:18 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-MKJbbIgnO8KCe2yfTKsABA-1; Thu, 30 May 2024 10:51:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3184E101A525 for ; Thu, 30 May 2024 14:51:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 980823C27 for ; Thu, 30 May 2024 14:51:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717080678; h=from:from: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; bh=xtU+ZGxvMcEcvyYBNZzBrBXprL5++gfxRt04sXKQPGQ=; b=UugJY6Bz4KBPT+dZPx/4Q2AKdaKIW+6ZTSdDmhi4md51lL3E0p2eGWu8SUngFKBaSwNXuG hv6/A/katWQ8DhsUD4dEGMqNxajDR4M/e42DFdXZLBvakALxpf/JH8M2NhjPcxfWW27oQE pqAibOv1P8FBvWu53Aj3PzumcPOKkLk= X-MC-Unique: MKJbbIgnO8KCe2yfTKsABA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 2/4] qemu: hotplug: Validate definition of 'FS' device after address allocation Date: Thu, 30 May 2024 16:51:07 +0200 Message-ID: <54a51139f8c282f00f33075335f024d4271d9c06.1717080626.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AIG6G26ASZSVYQA4B6RDTZUWUPWNAZAR X-Message-ID-Hash: AIG6G26ASZSVYQA4B6RDTZUWUPWNAZAR X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1717080866464100001 Content-Type: text/plain; charset="utf-8" Some of the checks make sense only after the address is allocated and thus we need to re-do the validation after the address is assigned. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4739beead8..416e89d00d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -40,6 +40,7 @@ #include "domain_audit.h" #include "domain_cgroup.h" #include "domain_interface.h" +#include "domain_validate.h" #include "netdev_bandwidth_conf.h" #include "domain_nwfilter.h" #include "virlog.h" @@ -3216,6 +3217,9 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver, qemuAssignDeviceFSAlias(vm->def, fs); + if (virDomainDeviceDefValidate(&dev, vm->def, 0, driver->xmlopt, priv-= >qemuCaps) < 0) + goto cleanup; + chardev =3D virDomainChrSourceDefNew(priv->driver->xmlopt); chardev->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; chardev->data.nix.path =3D qemuDomainGetVHostUserFSSocketPath(priv, fs= ); --=20 2.45.1