[libvirt] [PATCH] qemu: Avoid overflow when setting migration speed on inactive domains

Commit c4206d7 fixed the overflow for running domains. However, we need a similar check when setting migration speed on inactive domains. At first look, it may seem the check in c4206d7 is now redundant but qemuDomainMigrateSetMaxSpeed is not the only caller of qemuMonitorSetMigrationSpeed so we need to check the bandwidth in both places. https://bugzilla.redhat.com/show_bug.cgi?id=1083483 Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 67ba487..69a7053 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11927,6 +11927,13 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, if (virDomainMigrateSetMaxSpeedEnsureACL(dom->conn, vm->def) < 0) goto cleanup; + if (bandwidth > QEMU_DOMAIN_MIG_BANDWIDTH_MAX) { + virReportError(VIR_ERR_OVERFLOW, + _("bandwidth must be less than %llu"), + QEMU_DOMAIN_MIG_BANDWIDTH_MAX + 1ULL); + goto cleanup; + } + if (virDomainObjIsActive(vm)) { if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0) goto cleanup; -- 1.9.2

On 04/25/2014 08:04 AM, Jiri Denemark wrote:
Commit c4206d7 fixed the overflow for running domains. However, we need a similar check when setting migration speed on inactive domains.
At first look, it may seem the check in c4206d7 is now redundant but qemuDomainMigrateSetMaxSpeed is not the only caller of qemuMonitorSetMigrationSpeed so we need to check the bandwidth in both places.
https://bugzilla.redhat.com/show_bug.cgi?id=1083483
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+)
ACK -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, Apr 25, 2014 at 08:09:10 -0600, Eric Blake wrote:
On 04/25/2014 08:04 AM, Jiri Denemark wrote:
Commit c4206d7 fixed the overflow for running domains. However, we need a similar check when setting migration speed on inactive domains.
At first look, it may seem the check in c4206d7 is now redundant but qemuDomainMigrateSetMaxSpeed is not the only caller of qemuMonitorSetMigrationSpeed so we need to check the bandwidth in both places.
https://bugzilla.redhat.com/show_bug.cgi?id=1083483
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+)
ACK
Thanks, pushed. Jirka
participants (2)
-
Eric Blake
-
Jiri Denemark