From patchwork Tue Dec 12 16:42:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 121565 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4353120qgn; Tue, 12 Dec 2017 08:42:41 -0800 (PST) X-Google-Smtp-Source: ACJfBovjK+uH+BZaFvqIC7fo6+RNfEh8S+TJ34wBGprJ31biGN/8OvziGsw5BRBOCJ3ks4FZdJEG X-Received: by 10.101.76.3 with SMTP id u3mr2541046pgq.136.1513096961891; Tue, 12 Dec 2017 08:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513096961; cv=none; d=google.com; s=arc-20160816; b=p0cuW+52ZJ+YCnMrlYM/5ZOYBqXUJZyfKw2i97wn+vprHDVbRnH331i6Bd/uswsSSz BireTWfmMrkPWzLtpRCPmuifu80Q8qw51RcIg4qZSgzPMaFsMT8ddMctpAkoAr3Nnemy 7hYAx2Z/p1Cmnx3b1SFLClvUurPuaHrdidIIS4ph2BoWj0xc3aERovzJd/sQ0McWpaIT hSr8An7ACAxCsYCO7NjxB8YfMCxsSr/B46FtUuXyNWyJ7IPjV9i9dRTIHZMPrZf6+F1m VCZ9OLgsrEp5vaQiQvqooej1NwTmeJHxTg/+x/t8SnSE2/cOhhCCYQFwJxxTq732Z2xE TgiA== 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=uYGzEc2TdUfIocFNBkWCJwBAQe84B4DXgIGYS1xYy+I=; b=Zj/oQDi5nmlrexXQD5H535kBFu3/OR+0gtN8NnBUm7PW558YD4u3ZkBz1othimCD63 fW5MwS2wMuSkc4crlwRWBUq90NLYYpEZJlvMLrZd36yGALdXQSUthGIcYZXks+tHQ+w0 tjWLgjs86ycc57WywoA5rphNsvRkJRDfUXnBmQmhhHbR0YrXihEJHYdeGX628LX1kuJW JYVrPxZHF4lwilw4DQFCupC5HEJ18gMmlVv/5ihkz89Xgs4mWltSwVhTeU3IZVN/VzOU PEI3GMGKKoRnLrJdrDHvMNg99MwocO5jC2YUkGIesUcmaLq/WHtkOTTeCf8C9eZbHjeg ezxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N5oMq6Lw; 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.41; Tue, 12 Dec 2017 08:42:41 -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=N5oMq6Lw; 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 S1751566AbdLLQml (ORCPT + 10 others); Tue, 12 Dec 2017 11:42:41 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33968 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbdLLQmk (ORCPT ); Tue, 12 Dec 2017 11:42:40 -0500 Received: by mail-wm0-f67.google.com with SMTP id y82so18125570wmg.1 for ; Tue, 12 Dec 2017 08:42:39 -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=uYGzEc2TdUfIocFNBkWCJwBAQe84B4DXgIGYS1xYy+I=; b=N5oMq6LwTLx7I8axh5LMaJ+WyWNflnAChCjut/Jm0jcFytWWACJP4uSr5H11zYeUQo 2oQoHRQ4tFNabbOJCM0tAJuwvG68qHW9uvi7ZpiF+g4Mo/ezJkynqhCxUT6xz6XN0WiW sZGnprbK/OmWsX0QQU8DcgSF8xqE/O+F1lDH4= 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=uYGzEc2TdUfIocFNBkWCJwBAQe84B4DXgIGYS1xYy+I=; b=V9pYQ6I9t7bSNubLP9ETYhQuUyvo3WCjV5j5maaeTFM2t/Qb6Y/p6TP41pAPTk2sEU DlYTdLnqoV1CNyS+3lpv+UWoga0Q/KrN9+9doktlKG+e+y0H6EoHG+tWABFvlbn92eNA kAWdEH3JI3TVPi1YgtDxzaLCX1zkKcrSAafCCJ5m8gh/lU/Q04S2I5WlITL46ESuLVvc wixA/dDs/xECNze4GgypHt2lSQkorC3zUAX74sTSBFO2clwgPm94YyYGjt+4ymur8pg4 9PwF9K14j7zPDNHt4fIJf8JlQ9UhEr7Laoj2PuBSwRYhdReV19m67dxB9d3tNu6a5Lho t28w== X-Gm-Message-State: AKGB3mIQ3J0ivEOedeRWrxLhco4/HXYkz6c5+VG5B1CjG/ZdmeK0OFkv BYggqWn0uHYxkJ0wpO1dWUDph7GIR0o= X-Received: by 10.80.219.69 with SMTP id b5mr3697507edl.218.1513096958858; Tue, 12 Dec 2017 08:42:38 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 08:42:37 -0800 (PST) From: Christoffer Dall To: Cc: Marc Zyngier , gregkh@linuxfoundation.org, Christoffer Dall Subject: [PATCH v4.14 backport] KVM: arm/arm64: vgic-its: Preserve the revious read from the pending table Date: Tue, 12 Dec 2017 17:42:31 +0100 Message-Id: <20171212164232.2908-1-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 547f12dc4d54..d5a8bfe78bc4 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -393,6 +393,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, &intids); if (nr_irqs < 0) @@ -400,7 +401,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;