]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Validate QoS values in qemuDomainSetInterfaceParameters()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 27 Nov 2024 11:25:12 +0000 (12:25 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 27 Nov 2024 14:11:13 +0000 (15:11 +0100)
This is similar to one of my previous commits (v10.7.0-rc1~22)
which introduced a check that <bandwidth/> values fit into
certain limits. My original commit validated values when parsing
<bandwidth/> 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 <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_driver.c

index d1b32de56ad7aecd4dbc48eabfa029bf2201db43..09f7edda7dc63bcfa928dc9a947c4722022345fc 100644 (file)
@@ -9883,6 +9883,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
     if (!bandwidth->out->average)
         VIR_FREE(bandwidth->out);
 
+    if (!virNetDevBandwidthValidate(bandwidth))
+        goto endjob;
+
     if (net) {
         newBandwidth = g_new0(virNetDevBandwidth, 1);