From patchwork Thu Dec 14 21:04:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 122027 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7324028qgn; Thu, 14 Dec 2017 13:04:46 -0800 (PST) X-Google-Smtp-Source: ACJfBotyvSl6Efy69cY7sNpwRRv4jZFTNh43qFf1Hd3w2UVYOKIp/bFtE8KyVo48ci0p5h4wrJh3 X-Received: by 10.99.159.2 with SMTP id g2mr9757573pge.240.1513285486312; Thu, 14 Dec 2017 13:04:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513285486; cv=none; d=google.com; s=arc-20160816; b=ViFySmXZzvqgj9J6LFxHsYstkdRf3SYHwvrns6TsyAdI+sB6Jin4ykSeUYPsihh3Ou BxlWMxrstnl31MZ3W/zDuEE1fADirsh6iSAPv3A5PDAy2ZOJHf86lvHNf8XkpXWN6fPp DfpUvwle9GMG/YH+SKNNJo/YFi0RN8QjVWLmQFoOIf35kbBqGNJEzUl7qsx/LhqdANDb YsyJWKsj/UmjukFFFhbQiQrmnmULJo1CozPHiUlUSDbZ/TtsusJPXaHTUvVn1SwTvnCQ PI1Qi8eKgMFmoEmKwyadZXOsT6hd3jSI0qJNdePApFHxjmNK9nnTUT8XQn7beSN+aJkg 5h1Q== 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=NyyFcPkGZpS4TD3RgZe86wP7zLcD84BHuI0bQFGy/jD3IJTDSPSiKDfjtdDFuhuUsF XNPVJ7JvgkXWNh/6HKu+wq7jyU+2IR6JT0crBpvSfjQRJpom4J6xcgr73/947bWOO1+7 4orfLxCZTXsfmZ4rq2Agw7ROdW3cpt6ZLuJLjugeCOoXATGIaHM4wMC78H9QVyyD7VFc cLrEUkuIUp+rBfa/HKnfSl6MdEvphuxR4RYEclwxnAPzLG8twnHhbYEIhDb5caMGJr+G yXj8M4HAYowAiojOZbCrDtaLLjtqe3sIhTQhKG8pzFiseOTnhV8Ze7dEaLbT5fZH9u1H aTsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uw4kXot6; 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 w10si3391449pgr.259.2017.12.14.13.04.46; Thu, 14 Dec 2017 13:04:46 -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=Uw4kXot6; 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 S1752886AbdLNVEp (ORCPT + 10 others); Thu, 14 Dec 2017 16:04:45 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:46037 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752508AbdLNVEp (ORCPT ); Thu, 14 Dec 2017 16:04:45 -0500 Received: by mail-wm0-f65.google.com with SMTP id 9so13819528wme.4 for ; Thu, 14 Dec 2017 13:04:44 -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=Uw4kXot67Jl6/Sb8GqABQZE9ZSuHu4WGYLE7mvakp6X33bOyqyyPUkeHwbXqva87yH 286yyjd5lkIxtVg2Kx83JYKAwuzbcnGyC7hQbEcCwD74UTEOGFnjcgOT3qiRynbsjr/8 01swvwQ0EDS51Q3m0HSeHurkHa650pdVYeALs= 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=huazfjCT2iAP2UBuSKI9e7vomAc23qWdB20wtT4Lwy9GBrJ5+YUxJFKHaFle7Oaxef rex43dEq/DAQro3grPzP+VQyyiWTDy3mTX07i2lmr3bVCLTQOPArAOsuuVTqCqHzpRqf Wrl34BF71Be9091x6WJx74plf+hcXK8T8Lx6lOrl4LyzQKECGkRJkQb89zQ2QHlkyWKJ 60Wg+O1fWndVfK5DW64O1qvQ3zAilZbpmiqtcqJcqf70QnEmqcCXeTderb7N0FEg8FJz 3lyAj7oDUyAq2TA/fURZKlXOBdp0H+4r/hLIKx2pvN8yvcQqMthu+8255Xd19oq+HvRF OUzg== X-Gm-Message-State: AKGB3mLdOYR5NURA1ksPyoqemi1egJJ6OYlRgrh1kNVSZmh1L5jksRkn o0FfNa/sMoaUF/NmDWsHAMTkQASEzd8= X-Received: by 10.80.205.156 with SMTP id p28mr14284287edi.255.1513285483683; Thu, 14 Dec 2017 13:04:43 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id f11sm4339507edf.28.2017.12.14.13.04.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 13:04:42 -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: Thu, 14 Dec 2017 22:04:23 +0100 Message-Id: <20171214210424.25740-3-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;