From patchwork Mon Dec 4 14:03:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10090333 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 2648A60329 for ; Mon, 4 Dec 2017 14:04:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B43EF2899A for ; Mon, 4 Dec 2017 14:04:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A901028D1D; Mon, 4 Dec 2017 14:04:02 +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=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 533552899A for ; Mon, 4 Dec 2017 14:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754453AbdLDOEA (ORCPT ); Mon, 4 Dec 2017 09:04:00 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:44809 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbdLDODz (ORCPT ); Mon, 4 Dec 2017 09:03:55 -0500 Received: by mail-wm0-f68.google.com with SMTP id t8so6000207wmc.3 for ; Mon, 04 Dec 2017 06:03:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=vvDjbfaM4y+/+S5Wqc95p4E/G7g6+DZ4+sOra8RrMEw=; b=He9By1adtmXQ868oH3dYKUprzaeEUXGlKzko/gYLJyX2cWuSEW5p5mxZWUZ5uIxqTs Jl5Fn+mxxwig2+VPutuEdnbyBdACDOmp0ZXmpGpN/snkyRvwcGOG/0+mY53ISpztddzL +/sIa+rG5881znJsrRFjl7Oz/xFH8J7ZyB8j9+/OEkSrBZR56Ypg2PwhefV86lR+WgQ7 v3Dt2gEjAltK+yFXQdgDtHNIeVcL7RHDSdZQ/sr+ZFM1rvSrN4Nw6UOKRsig/KZ5gom7 TyG4KXluQPSVjXV6pYObBQVUgTYjU/slADkmMPu15mOsz34gilfg0KIV9K0cZwr5JYgP 1BPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=vvDjbfaM4y+/+S5Wqc95p4E/G7g6+DZ4+sOra8RrMEw=; b=Qgjaplk9vaRSJdrK1EzyrZ8AVwS2Lme1q1MLB/FYdSlMOQv8UJNrP3P+lPIpOTK+CO cfsGKwCE013hA9J1aOwF6x8l3UiD12JVw+YDJv6eSm6OaM5T6tDeLkUi9raxFlmO+8K/ tIVKJ8IPNguqglvJtQ8HfmUKTMNkZri5m5jT3WgpRLKhO4x+KgsapXNuvALTUM8TMDnP 9YGfVNvHsOXETqSgsd8A374J4TshFEeUz0sk+RN/fKkA481+mSdy6Le7G9CTqjoZHf9V Fg1inwOF/Ma8tSU+ukcJ0K7Wkyu2rneSpchhR+JYp2EI6VF1+Dj8ID0ih7tVuKSac6RX ugCA== X-Gm-Message-State: AKGB3mKusuK2VX+q5wFH7CTUyCmn7rQ+FA1MulspXKyXdUpyTEGGF6X3 HjU2sgrj3LjMLmZ0VyXZ9Aj7hQ== X-Google-Smtp-Source: AGs4zMbLFGhud2rGWNyDkGY1wPxSZG2eayVyEH3c4eDLWXEoIgQKyHvggiGeuCzwxeJIY7ze4bSnEg== X-Received: by 10.28.104.6 with SMTP id d6mr2972448wmc.101.1512396234346; Mon, 04 Dec 2017 06:03:54 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.03.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:03:53 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , stable@vger.kernel.org, Christoffer Dall Subject: [PULL 05/19] KVM: arm/arm64: vgic-its: Preserve the revious read from the pending table Date: Mon, 4 Dec 2017 15:03:34 +0100 Message-Id: <20171204140348.21965-3-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier The current pending table parsing code assumes that we keep the previous read of the pending bits, but keep that variable in the current block, making sure it is discarded on each loop. We end-up using whatever is on the stack. Who knows, it might just be the right thing... Fixes: 33d3bc9556a7d ("KVM: arm64: vgic-its: Read initial LPI pending table") Cc: # 4.8 Reported-by: AKASHI Takahiro Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 1f761a9991e7..cb2d0a2dbe5a 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -421,6 +421,7 @@ static int its_sync_lpi_pending_table(struct kvm_vcpu *vcpu) u32 *intids; int nr_irqs, i; unsigned long flags; + u8 pendmask; nr_irqs = vgic_copy_lpi_list(vcpu, &intids); if (nr_irqs < 0) @@ -428,7 +429,6 @@ static int its_sync_lpi_pending_table(struct kvm_vcpu *vcpu) for (i = 0; i < nr_irqs; i++) { int byte_offset, bit_nr; - u8 pendmask; byte_offset = intids[i] / BITS_PER_BYTE; bit_nr = intids[i] % BITS_PER_BYTE;