From c4d6bd3bf5fe967c5523e32d980dd17184d66715 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 27 Nov 2024 12:25:12 +0100 Subject: [PATCH] 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 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); + if (!virNetDevBandwidthValidate(bandwidth)) + goto endjob; + if (net) { newBandwidth = g_new0(virNetDevBandwidth, 1);