From nobody Thu Dec 26 18:30:52 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 1732710095923334.8594836271146; Wed, 27 Nov 2024 04:21:35 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 42EA21B6E; Wed, 27 Nov 2024 07:21:35 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BCC661962; Wed, 27 Nov 2024 07:21:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 500DD18F5; Wed, 27 Nov 2024 06:30:11 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 5E17618F7 for ; Wed, 27 Nov 2024 06:30:10 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-297-eWl9EKNeN-WeC8ZjuG9TCg-1; Wed, 27 Nov 2024 06:30:08 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DFA66195604F for ; Wed, 27 Nov 2024 11:30:07 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.3.236]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2E15C195E485 for ; Wed, 27 Nov 2024 11:30:06 +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=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE 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=1732707010; 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; bh=yqe8/asy8tdi49gDb00dWKqmZnQY0C/CF9rljtghKF8=; b=JYVsrFq8OkSjnPamO43aZjFVQcWsc8vPSf26ieUVMXECU4CSbGYWcRoEAffbxnXp9G7pVs HkfVAVA9omIFrXMF+v+ZmdvnU5SfshpEkF+JmtVGM0YBfbAP3ICKBLYsF8qkVAjtZ5TUoq RcefURBTPV1wO2iFJSJ6cF1aZl7vQPM= X-MC-Unique: eWl9EKNeN-WeC8ZjuG9TCg-1 X-Mimecast-MFC-AGG-ID: eWl9EKNeN-WeC8ZjuG9TCg From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH] qemu: Validate QoS values in qemuDomainSetInterfaceParameters() Date: Wed, 27 Nov 2024 12:30:05 +0100 Message-ID: <3bc0d89404db48f00a0d695d06bd12f9af43794f.1732707005.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: KEFtP7zE4AWbvywRzMSZl9ZC5zqseGb1H13nKt2RWQc_1732707008 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Hits: administrivia 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; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header Message-ID-Hash: NRVBNENQ6R7F22QTS43QTVLAV66X3U2E X-Message-ID-Hash: NRVBNENQ6R7F22QTS43QTVLAV66X3U2E X-Mailman-Approved-At: Wed, 27 Nov 2024 12:21:18 -0500 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: 1732710097521019100 Content-Type: text/plain; charset="utf-8"; x-default="true" This is similar to one of my previous commits (v10.7.0-rc1~22) which introduce a check that values fit into certain limits. My original commit validated values when parsing XML, but completely missed the case when values are set over virDomainSetInterfaceParameters() API. Solution is simple - just perform validation after bandwidth structure is reconstructed from arguments passed to the API. Resolves: https://issues.redhat.com/browse/RHEL-65372 Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d1b32de56a..09f7edda7d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9883,6 +9883,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, if (!bandwidth->out->average) VIR_FREE(bandwidth->out); =20 + if (!virNetDevBandwidthValidate(bandwidth)) + goto endjob; + if (net) { newBandwidth =3D g_new0(virNetDevBandwidth, 1); =20 --=20 2.45.2