From patchwork Thu Dec 14 21:04:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 122028 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7324121qgn; Thu, 14 Dec 2017 13:04:52 -0800 (PST) X-Google-Smtp-Source: ACJfBotG+qa3F9vPiqZRfPlukJALW1n+1APgRV6TY4CS4MC5IXf5r4px4BdePnF7Vi6vaJYUp3gF X-Received: by 10.84.239.1 with SMTP id w1mr3419825plk.368.1513285491905; Thu, 14 Dec 2017 13:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513285491; cv=none; d=google.com; s=arc-20160816; b=lUhAT6TFqVZ+wNVDAGF6rjmPD3fi0ovEhPUwqEh3R8HEwx90eC7OH7D9xxalqJB9Y9 3v8Thuw1Pgiy06Xpk49DPOhOm6Yq6wQAfDd3m+pCLn6hPQQdufQConRJByoz7IbhEmvp E5pQK5fFkDQj/hYawvhYl7Hg0xUrkmmB9oCwqpbNKWV+Um4bc4rxyUxx2/jfDNX5NdG1 By1L5FvfnMqG4o8Au8wEFc7bx8g4SEuwqS5pIHH+eidl6tRc7DPBgJ7iOW6ELMuL7AYK 6BZ0nO9GSCsAVvVLg6k49liFFjjIuAI7JlqRp28Bk9zFokA3Mo0gbNgnnDnDIzibQjKe NioQ== 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=rdnvA26C28aPNpNG4nHkjFEDaQeRjJyoSao8KfggdqPzn0sOtZL1pC8R4PnuwwhbeT 1in+pUc2EFsaNhuQSVUSgZKtx1loFXINywRzI5RPMn5caCtOIhhkTGJUYXwQekXTxbvC uURPvCsz1bv06Dpd0Fudpplss4EShcD5+JCxf6+Gqk0yW3bh6SJk83nsECithO0o1UlC dcEPwu4nu/Dwykh4LMdtEN3kXPZf1msyJAniw6bqw7Eu7U/BR73jW/feaKsquSHAQxSR EHkG9gjNrVkP5GpcUrXGoXEn3yezsxz8xOaMrUGgxMLwAUPfepy2qzYmtyt3BWedPFv7 O/Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NIHWQTjo; 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.51; Thu, 14 Dec 2017 13:04:51 -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=NIHWQTjo; 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 S1753279AbdLNVEv (ORCPT + 10 others); Thu, 14 Dec 2017 16:04:51 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:42931 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753012AbdLNVEu (ORCPT ); Thu, 14 Dec 2017 16:04:50 -0500 Received: by mail-wm0-f65.google.com with SMTP id b199so13955131wme.1 for ; Thu, 14 Dec 2017 13:04:50 -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=NIHWQTjoTm3NX4PQH1Z3qYW9m6HkvwhXSlsR5GjWaS6ItrxdDSFxfGMFtc1DCIUCuY m5+ugIeIiafsNKgvTndWhF2theuKLSb3/iK9Dd58rpjtZ7umx+mNh25eISqnhV/eK8JK +dNtDx/4xu43ZDeOL/SLHjvuN+cssM/QT6DDc= 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=unyYI8bl1ErB051o5C50RNfNsxbdivRa6vY4jwPvjmBCXpEM50Hiv3rhlgFW2Qe++n yZA4m/MKefIHYoCc9QipDfioDVVluy/ZkPb3PRzMbzaxOSG/1zGl4w3KIkc1NhX71X8c DaWcUN9K0uXqPJr7WFZyMXdqQv1iwtmz7s/pR/QzungNhL3bbHlr1iLatJEEYk0DGwBA QPhvNupff6+JkrHYdEbHR3E1M0zHE4AtW4npkpCaiFGIzvwzd1edkfaZ1levHAuLjLra Qe/pbcXtgzsTCHF8cwY/0G9iqCnIslouw58IAhyubf3gVvec9lx4Pn/l+m3OoMZn1slm S2/g== X-Gm-Message-State: AKGB3mKybEwLE+uoMgNin63cXMRljwELG155ZcNgzqCtb0zb89Oh/OLs SJ+djCMz7vLAtwBJazVb0A4cOq6MeSg= X-Received: by 10.80.226.130 with SMTP id p2mr13809991edl.177.1513285485288; Thu, 14 Dec 2017 13:04:45 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 13:04:44 -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: Thu, 14 Dec 2017 22:04:24 +0100 Message-Id: <20171214210424.25740-4-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;