From patchwork Tue Dec 12 16:42:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 121566 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4353146qgn; Tue, 12 Dec 2017 08:42:43 -0800 (PST) X-Google-Smtp-Source: ACJfBotg8yKUuNwYtCou9ocjyP4GbBWEC53ch8zb0s0W2i/LSv9z9dnnGgtiSR/Tu7cLpTIEr2FX X-Received: by 10.99.120.196 with SMTP id t187mr2478831pgc.285.1513096962946; Tue, 12 Dec 2017 08:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513096962; cv=none; d=google.com; s=arc-20160816; b=aZOnqFdbxv5uOeZdYcCRAR5Ua/bgxkxqcKa1NJ7eUkOzdg2+iPcM51MiDg4PuIX9ZB 4RY4/WQa9hsK41p+ykNwUqWFnOpBMrTc+mHIUyRoIq5JRPpCh6OgoRzUCEj/KOqq3QBO JtKoC8Z54uBxVa88/SuDMPPal879PW4/9D5BlKsK17Zugq1xHJtDmyAi5RALHvttPN83 NiuOBCwzt7Xpw64QGjgajBdIf+KGuEyDMzlj5W8yIhfPVoer15HpyZJgEh2xa2/zoe8U gyjtN4xz4dwZ2C9z3J/LGeLsTLGxmQmgdgIAiDZe0nvNZHykorVt7xDDfzOKbaKMbUHn AB3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=sxbi8AhvEmYywx4jQ8zepX597PrM4KdozifNgccqcJI=; b=PU37BGcsOTh5TPfNiohI/AjEgbbygzoNnNKwv2z080qJ9BAjrG0wLJRmi/W4vlBlgq Ot8FUfTax2mJEJjiYvEjYh46+6TO0CXCV89cwhdrUq5/7qvfP7dzXqPPUyut4vIOWgSf UIeo6eIygUWHAbZoyd/SNSs8+jQihjxQJnc2OBntzVqF9GucWNAiYChe2Djkq34ogSk6 KJHyoc2Xbc/s8WvjpsMnjiYIpaXaOIU58w4reMo0bZZ4Xwlqd9hoTyWl7/krJBjtTexh wVkIsUS+HIJ7Cy8AXv1ucTK/LFficO2P70wBhQ7Yq4IZ9ajs9FhqzpNJBFQgwcUrDVCZ +GKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DPbaX+gE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l14si6207632pgc.748.2017.12.12.08.42.42; Tue, 12 Dec 2017 08:42:42 -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=pass header.i=@linaro.org header.s=google header.b=DPbaX+gE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751612AbdLLQmm (ORCPT + 10 others); Tue, 12 Dec 2017 11:42:42 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39301 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbdLLQml (ORCPT ); Tue, 12 Dec 2017 11:42:41 -0500 Received: by mail-wm0-f67.google.com with SMTP id i11so21431524wmf.4 for ; Tue, 12 Dec 2017 08:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=sxbi8AhvEmYywx4jQ8zepX597PrM4KdozifNgccqcJI=; b=DPbaX+gEPIjJAj+Cwtq2MWc9LSGJGOCu5dtSYfS7mjsb2g8WGrpwrVviH5quNdNIpQ UYDC4spdWzD3HRcBysY8YdqfuQJ7TP78YykLH5kXAaGCW2QnO4cftYqkcfTM8qMJMlsE O1qeB3Tk1CX8Lw/Noy+Igukxq3bcmytp8a8V8= 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; bh=sxbi8AhvEmYywx4jQ8zepX597PrM4KdozifNgccqcJI=; b=iCjsKRd4hwRgvNDMmcQyh7jJX49E2sW6Bd00HzAfLzqTXhX5uEXAqIUx6zCccWq8LS x22vN424I2DWxi3owJ8Xr5C0ybB3X6zLEe4QFAgsprqT0QyEJW3F0S/HaEuQfP0RGTCm LH5EN7xEAShizpKW5U1gEmGLBIrWFweC//AyqnLU7ZNamOihKjZ7Jh46q/7EQGkyocK6 4G6I9YEMGWXec1tn/INZJCeA+cbqp6Rdx+CwgMKiQvGONQCE7GBtHXVrdGY3HFp1Tk/3 CX02gUvSl9dmFnfDdv2c3ysU+UZUmKPFUJAFu3pL7arYKrt1W9flzfDN5MNJWEG8E0+E 9I7A== X-Gm-Message-State: AKGB3mLpxjUiCVVVxHEw2DvdmkLiRaEwA3C1EZbuJgRr84HVE5zdPUzC INetM3Djzp1DZW3i4y2fMjJu/B8wP8U= X-Received: by 10.80.182.148 with SMTP id d20mr3646381ede.63.1513096960145; Tue, 12 Dec 2017 08:42:40 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id k19sm7939338ede.35.2017.12.12.08.42.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 08:42:39 -0800 (PST) From: Christoffer Dall To: Cc: Marc Zyngier , gregkh@linuxfoundation.org, Christoffer Dall Subject: [PATCH v4.9 backport] KVM: arm/arm64: vgic-its: Preserve the revious read from the pending table Date: Tue, 12 Dec 2017 17:42:32 +0100 Message-Id: <20171212164232.2908-2-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier Commit 64afe6e9eb4841f35317da4393de21a047a883b3 upstream. 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 4660a7d04eea..bbd4a988e8c1 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -322,6 +322,7 @@ static int its_sync_lpi_pending_table(struct kvm_vcpu *vcpu) int ret = 0; u32 *intids; int nr_irqs, i; + u8 pendmask; nr_irqs = vgic_copy_lpi_list(vcpu->kvm, &intids); if (nr_irqs < 0) @@ -329,7 +330,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;