qemu: Validate QoS values in qemuDomainSetInterfaceParameters()

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>
This commit is contained in:
Michal Privoznik 2024-11-27 12:25:12 +01:00
parent 9b55a130b7
commit c4d6bd3bf5

View 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);