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: 10090365 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 6112B60329 for ; Mon, 4 Dec 2017 14:05:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47DAF2842D for ; Mon, 4 Dec 2017 14:05:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA5F2877F; Mon, 4 Dec 2017 14:05:39 +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=-2.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, URIBL_DBL_ABUSE_SPAM 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 BF54F2842D for ; Mon, 4 Dec 2017 14:05:38 +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=Qav+tnlBm8famiLcR/5fQ58vRFRZB/BpxHlQuIfiR24=; b=OlyTz+2rLsbSOhJOvZ5fK3gG9w x6o75UkvciA1Hv5ivm8zagff2h5m2tz4ewOTbH4NcYxqSqAajws4Hi5NC6Ks6t8vqqoUwAzHbPLcL aD5KKelsGRJHb3Xdv/tRWQyvXL176pJulKLuwurbPhi6wlE9E+HD6z61ERbQX3S/gL6vIyHB3e8Bo lnTyGxW5Gyaxexbz2MZ8/FPDWWUVvU9zxvDOoSkrabM18MLL4U73Ti7O18lXKHLpJhnVqPOpC/FBR +XMupBtETd/G/h0r6anWwOqb7Og4OTXpaHxtF6MhfYp4ahsogbZ5YWgdr99H1Gnlcl6aBha5qlpGE 7ufLf2lA==; 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 1eLrNJ-00056x-FQ; Mon, 04 Dec 2017 14:05:37 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrM0-0002Nr-63 for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:04:22 +0000 Received: by mail-wm0-x242.google.com with SMTP id g75so6044881wme.0 for ; Mon, 04 Dec 2017 06:03:56 -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=DnXLwIFvAgy5p/Rh5FNcowg9/iP6WZEkJMk5pPSjDmi1UT0nEndDLWSbikQU+OEzoq nsqxlB5KfUexO9IOt+gF3V/9kyo3X6jnjR9MFxxEYC6xH789yGkiqrFLP6MlXGZx6ePq AHQXfmbTpw+FZsoFi2vgqce2t7sHxOEXvoqzU3hdKlcxbvvIMdSFvPqysnBKHVAPrwNo iAgkYOf94CPKe/L0XtxZ7NEwvbIACt4MTg0BFacS1HApCVjli9gwQc9vy2z0ScymgSKk gDhunOsCTrqEXJwcvcgngrqBUoV7AStZ3Ebu4PiIYls/kEEsHVD1W5qf1DqCnBqc8N1q mSPg== X-Gm-Message-State: AKGB3mI17ai5rsmASsww3ZK+j4KAGd5xjyTTONXinxpce4kx2Bi0WLgF 2AsBgRDeh8UO8xGJBvC1JfXnhw== 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_060416_431749_6E936991 X-CRM114-Status: GOOD ( 11.36 ) 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 , stable@vger.kernel.org, Christoffer Dall , 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 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;