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: 120539 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4472493qgn; Mon, 4 Dec 2017 06:04:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMamaTF15AswoX7pUa1ch5EQ0Yhqq3rrpVg1lStQLYP/N2D2Xp9wEd0C6rroB5rayFsvfMEG X-Received: by 10.99.97.200 with SMTP id v191mr13444343pgb.300.1512396241531; Mon, 04 Dec 2017 06:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512396241; cv=none; d=google.com; s=arc-20160816; b=X6lQSc5AamyyLIeRP0RuzxAKtpxs06VX9jDE85NJEwIWJJ6lC54w8UJDNJqxmdycqs oHGFW7D70UYbzMPOiuQTG7Xb8jm4mJrKXF/RbTYytNyp7quG2jeYa48UdOH+oAT2HIz/ gtItGyepBr9b3ijVxm1jU8RJ+cwCcQVNc03BSl2btQUmE7djBJ3F3kjFHvy0gFkkp+gT J0WyW9z2Kl/e69nK/pwcEDZJQ+SZvGyDfsNYlAhqbtCmTRqcdeuGW0uQ3mHPhcjk1Aar riq/jhE/xWw9DKEp0kIMEqwNqpXCVrwF3kQh1/BDkpkZhYR3DdFRJhYiaQxXrVYOM+xj Vf1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vvDjbfaM4y+/+S5Wqc95p4E/G7g6+DZ4+sOra8RrMEw=; b=snyUbFFVmH9pytlFZZTpilYXuwVwZQVDmVOr1WHIGFumKDGrRMK51e6lm5AQ4xjw/X +vArw+4RaoTfagp0XODlhd84YEYak7Ci8qOQk4Gh898FtPrxH7AABvpLmZwNTS/hsoUj FlIEB/kqHfY/Tv16pBpc8hkr+G4Inx+yDIxcpJeayKrXSyJtZyVH6m4Xs6diWK19D3Y6 emmS/oa4+AMZwgh87AtyXz5pajNOnPc6jcpUYZqdH+dw3PwgrHlK6r/PYTQTzZAgYYJI M/LNVYmXBZS20AoEXSgjDO3ifDCg9n5WLBdnDX58Xsv12xVshrTwM/FzhSO6VvKS/jpm EUbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=He9By1ad; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g31si5138782pld.67.2017.12.04.06.04.01; Mon, 04 Dec 2017 06:04:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=He9By1ad; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752231AbdLDOEA (ORCPT + 9 others); Mon, 4 Dec 2017 09:04:00 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:46940 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878AbdLDOD4 (ORCPT ); Mon, 4 Dec 2017 09:03:56 -0500 Received: by mail-wm0-f67.google.com with SMTP id r78so6019017wme.5 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=JjJi59M2/Nvl4PTLRK/hES17NCW9zGG64xCAy2amuduaT8CzMKY7cTDVDFUTicOpUb XGz/f5gNxcOIDdEhqrPwRlN60izDLUjWOxAonPWYH6hOuJKclVyDXoq7FvvdSCG1hdnx fIbi8vCwVkWgnTeBpCsk1oOPYhy94n91wA0SFAu6H+uCsqvjpzJ+Voqi9JMCYxJloYHt vBokNdP7zodrNylGCn30JyMU2ACyuha7KH1V/t0H1bZjtKP/obP8dfEWHLcIN91fFKid 0anEUV5cPWm3TvQ+nUQ+8soYL4Ke2cytqhtt+g2p+7MQJIvCGx/vslwdiqLyicyxhqhl 8l/g== X-Gm-Message-State: AKGB3mJz8Or+TnxYrEmi98Nz83g7Q+5uC7SCjQ+vrlG8vX4s/rh1y4pk 4oW2f1eAmYgjjsCMglj9jNKBZA== 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?b?UmFkaW0gS3LEjW3DocWZ?= 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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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(-) -- 2.14.2 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;