From patchwork Fri Sep 9 21:13:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashijeet Acharya X-Patchwork-Id: 9324403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB14160752 for ; Fri, 9 Sep 2016 21:14:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A91A82A001 for ; Fri, 9 Sep 2016 21:14:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D7342A009; Fri, 9 Sep 2016 21:14:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1FCE72A001 for ; Fri, 9 Sep 2016 21:14:52 +0000 (UTC) Received: from localhost ([::1]:60291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biT8N-0000D8-IR for patchwork-qemu-devel@patchwork.kernel.org; Fri, 09 Sep 2016 17:14:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biT7y-00009q-Rr for qemu-devel@nongnu.org; Fri, 09 Sep 2016 17:14:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biT7u-0005ir-J7 for qemu-devel@nongnu.org; Fri, 09 Sep 2016 17:14:25 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:36803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biT7u-0005ic-C5 for qemu-devel@nongnu.org; Fri, 09 Sep 2016 17:14:22 -0400 Received: by mail-pf0-x244.google.com with SMTP id x24so4484257pfa.3 for ; Fri, 09 Sep 2016 14:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=TnzJj/l7x838kUntzs3c1vOfzzKcZZPrg76azpKvjbU=; b=pa4VlbboFSQ71tOsRKxiFt6SgVIKzViyh8JLM/GbWlBxRSm6vB06/b8Kch1w0YHevC j7Gf1hQnB3j2ROT947RbZohbNQSCkEkJ0WWiBlUOc/015hP+xKhYd1rgEqBNb/h9Kgwb T4jiIFQl3YNyxvHC7n8M3kJ2OI4IRymWaPmYnik8Rus85Ji2MZtBWTvihH4OI3PolPWc iQzOXWu89dE8GJrZaEwTt4pnkGgHP5L62X6hQc2SHf5GqETWYWYZcFLI7kXmkM8oM3Xn K5PUblNYTk9xt5jA/Ui6FGHrUM222ak/C7SPAe4TeNbsVHk3aJPVDJfAZQLfReLM/sug bVVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TnzJj/l7x838kUntzs3c1vOfzzKcZZPrg76azpKvjbU=; b=frSiTYnLParZ8OoscgqsFJgXBxKDEHo+ADcTINrPsEURq5WKINWcLNrEnIwbeO+TzN DCa++DOmWN99N+bXf4GBkyBhCuGvpHUFrUxgDNQPQlgqkJnzSMUsYgntnUDmMyWxxwve eUpUY5A5lQ5VYIhmhxUegAUAG9SI2csDFWGaOQvYtq8399M0+CzeBH+/4YG/NVtpeFka 8fjgY2xWLYORORs3pgu1VEPBtkADnhZNBXS2nzssI6FE7ornG5uFioRUfvio18EU7nsL lyBh2xfw11MoyKJ5HV+Ti90MNw9jXuAdX37uqKaWJxF3e3ry1vC0wyHkdnYdCvxJX4sU 1+fg== X-Gm-Message-State: AE9vXwNJNGdD2PTWUeJJxwQzFfwlUSEhudOVvqcKToxH3Ptj9+hs266G8DSNG4JZzEwVkA== X-Received: by 10.98.79.27 with SMTP id d27mr10257334pfb.127.1473455661535; Fri, 09 Sep 2016 14:14:21 -0700 (PDT) Received: from linux.local ([106.208.12.73]) by smtp.gmail.com with ESMTPSA id f16sm3253185pfd.84.2016.09.09.14.14.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Sep 2016 14:14:21 -0700 (PDT) From: Ashijeet Acharya To: quintela@redhat.com Date: Sat, 10 Sep 2016 02:43:17 +0530 Message-Id: <1473455597-3107-1-git-send-email-ashijeetacharya@gmail.com> X-Mailer: git-send-email 2.6.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PATCH v4] migrate: Fix bounds check for migration parameters in migration.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amit.shah@redhat.com, dgilbert@redhat.com, Ashijeet Acharya , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the out-of-bounds check of migration parameters in qmp_migrate_set_parameters() for cpu-throttle-initial and cpu-throttle-increment by adding a return statement for both as they were broken since their introduction in 2.5 via commit 1626fee. Due to the missing return statements, parameters were getting set to out-of-bounds values despite the error. Signed-off-by: Ashijeet Acharya Reviewed-by: Eric Blake Reviewed-by: Amit Shah Reviewed-by: Juan Quintela --- Changes in v4: -Fix the typo in commit message -Include the commit id which caused the regression --- migration/migration.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 9b4aa55..cd8334c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -805,6 +805,7 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); + return; } if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || @@ -812,6 +813,7 @@ void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); + return; } if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) {