From patchwork Sun Apr 23 17:09:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695193 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 30B57601E9 for ; Sun, 23 Apr 2017 17:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30CB7209D8 for ; Sun, 23 Apr 2017 17:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2536626530; Sun, 23 Apr 2017 17:36:57 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B33FF209D8 for ; Sun, 23 Apr 2017 17:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=49D8lubU4bPXuwC9r4klVSe7KMDSFuEwGta0IT6warM=; b=lk7zUgUdrdi9dPdiuBkqzGpp9j KTxsTPt6wD+/Of6DAueoRYzI1MlVX7EHeVkemthCtmPati5p9xqCp18z4/da9+KfhkrP6nlf7JE58 fsmoQZfVwe1jjv7hQzAMBf7l7fWNXUUW8dL52cBoK14QfqwLDZ5+b50bSYvpl5dLgtR7Temkk2uvb kaSl/cpg7zJu0WjH4F66bHwU9DJmLslVfKPQXWDRdXrTW1CXchNFAtDH2GesK/7gj42ITpRqHmRnw B//epapt9g6xSvTiuof+FWnAt/mstpcfgt8dz6hEhjzO+GWW4gFi8NyziRegwfLs32oTHYJ4euXVK kDA0P0Bg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d2LRN-0002Of-MX; Sun, 23 Apr 2017 17:36:53 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2LLs-0002ZO-6F for linux-arm-kernel@bombadil.infradead.org; Sun, 23 Apr 2017 17:31:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XrbzKHlvRPN05/NTWTrdMWue/DTmgPqQnIrbdyxQ3Vk=; b=HLNQsY71drMTh5XBx8yvlaCt8 sCrCfmWBk8QTi8T+es82IQjeupouuP91F6vxFlRvPEQ0Rhnl2oKOsEVf16+KP/aKTucSkdH3yxvKT SusAKo5bvW9sewcVgJxb31yCvlV+lSAPA/4U6JIqiFXLUD8it6UvH6eAP6PoRz8q+J6GkAYw0whBp biZDFaD11+NHjRiqKbtaLufRhJ0hWeBDrWNQUKaXwRSOOcE+AK0Z6HgIbw2YiObH12yf6av3KFfQ3 E7hzL5vRInzsZTtl2dNz1dHqwlHB9A6H12k4vkTPkKk8+6TKuhmcxEpX85knCg+oNtIisrRI4EQcS O2NLEdYGQ==; Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2L4W-0005Sf-C2 for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:13:17 +0000 Received: by mail-wm0-x22e.google.com with SMTP id u65so7510636wmu.1 for ; Sun, 23 Apr 2017 10:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XrbzKHlvRPN05/NTWTrdMWue/DTmgPqQnIrbdyxQ3Vk=; b=L1BFNAu1L3nT4wf+hAWpp8WqII74JYaXleQ+I7lc7QIYtbiVwJgVXgbbiRQttr1wBN IiKeKLHlUlKBPTIZPafcFci8nIxDRsr9M5qXyio5r7AzNhvh6kz9Dyor1dj+oIqNougE 0jlhikHyDTTfe+mr7J5jBACFdNVZ5mGQT56uE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XrbzKHlvRPN05/NTWTrdMWue/DTmgPqQnIrbdyxQ3Vk=; b=WqnVVXRzRSRfzPrlW7yjsdMqjhvxemjhszcSwXjQ2CkvXKEjdtMlDuw65yolESs2x1 inKRUSDmyx4cBn4E6rFu7EG5+pTcm8kEv7hg4o6jio7nW3iY4hd3lmf51cDQlB/ORzbv iH8kuVOaQBsRI7TOisiZBkX7eePgtryhLEzfwJW91wrwtXd5BQlFIOEFOxEB76DJ7eJa YH3bhyjyPRlCcz3m1f1g59TjMmpZGeIAi+DopY9jETqZdOdqvhYwzG/KRScDOCYcIBqA kXVNZugbEx9UoJLhhSUEN8s03DUxfwCngjTX45NWht4YE3BFQkSNbWA4d3LO2Z1wtsG8 qiBA== X-Gm-Message-State: AN3rC/6K1IkWmWvOdneVLzXtMMPyYuc/heEPsrq6lq4RbGYRr/yrM0D/ /Y0lE4iHX1s27EVudoLYUw== X-Received: by 10.80.180.136 with SMTP id w8mr144132edd.112.1492967454317; Sun, 23 Apr 2017 10:10:54 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id 58sm2803521edz.2.2017.04.23.10.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:53 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 77/79] KVM: arm/arm64: vgic-v3: Fix off-by-one LR access Date: Sun, 23 Apr 2017 19:09:27 +0200 Message-Id: <20170423170929.27334-78-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170423170929.27334-1-cdall@linaro.org> References: <20170423170929.27334-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170423_131316_541442_C5C5E76B X-CRM114-Status: GOOD ( 10.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier When iterating over the used LRs, be careful not to try to access an unused LR, or even an unimplemented one if you're unlucky... Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/hyp/vgic-v3-sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c index 91922c1..bce6037 100644 --- a/virt/kvm/arm/hyp/vgic-v3-sr.c +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c @@ -143,7 +143,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) val = read_gicreg(ICH_VTR_EL2); nr_pri_bits = vtr_to_nr_pri_bits(val); - for (i = 0; i <= used_lrs; i++) { + for (i = 0; i < used_lrs; i++) { if (cpu_if->vgic_elrsr & (1 << i)) cpu_if->vgic_lr[i] &= ~ICH_LR_STATE; else