From patchwork Sat Dec 10 20:47:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 87588 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp950665qgi; Sat, 10 Dec 2016 12:49:54 -0800 (PST) X-Received: by 10.84.173.195 with SMTP id p61mr170962784plb.68.1481402994084; Sat, 10 Dec 2016 12:49:54 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id l186si38399897pgd.327.2016.12.10.12.49.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Dec 2016 12:49:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFoZg-0002Xp-PM; Sat, 10 Dec 2016 20:48:52 +0000 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFoYO-0001uL-Vu for linux-arm-kernel@lists.infradead.org; Sat, 10 Dec 2016 20:47:36 +0000 Received: by mail-lf0-x22b.google.com with SMTP id b14so21783461lfg.2 for ; Sat, 10 Dec 2016 12:47:13 -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:in-reply-to:references; bh=m0DA78N3uRpPZYFGBdr+eqoDIGse7OkA3OXdLJc/JKs=; b=jjLBClzLpVSihvvoxb+C4aGxVzGhHfBTh59V4lFbNpaXX3OlXGHxZT9V8kd9HVHkl+ Ip5vouSj8y6QgBVmDU+2qmKV6u5eRMsB5el/NKEGmD0zkmA1VR2/7w5p1DlfN1j4q740 ohj6uzZEw5dq4jHcg5edBDjaJlegpydV2Q7VA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=m0DA78N3uRpPZYFGBdr+eqoDIGse7OkA3OXdLJc/JKs=; b=iI7vuhPc0YjaYqUxvw7XbukcyePUXGVq5jq88EEQSVk25bcWXMH/ySLN2rlq5Jxrjn QnEnowMkfc89KyPIxqZhKxVm49wI4YnRcfUchM1re0hTWWaK5NyeZ7CGB9u9qcV1MNuE 6eVaW/O38eAC7UckRcoGzDaViuDLnpBUAtdOUO+V0Vo9mWEtL2u9//e5r0oAity6hzqR sDe3o1UvR8IuT3yRgd+4BMghEVBz+TFrPSKsfb11BXG2KyWOKgraqQnW64dnnWdSHXgI fs9K2Pa3AfYMkF29jiYA3X03IHkOlPDer0Del49OyGgcZ1mUVPNAZYsmG6dNhMHasVWR 6syA== X-Gm-Message-State: AKaTC02KbgI7cuL6+Tni/fxx/QEQSCyhsH1UFIRrfzlcplivU1Tyu0G8EmhmgMS7fBPyN/UR X-Received: by 10.25.150.210 with SMTP id y201mr29676325lfd.58.1481402832257; Sat, 10 Dec 2016 12:47:12 -0800 (PST) Received: from localhost.localdomain (x1-6-50-6a-03-de-ec-c2.cpe.webspeed.dk. [2.108.209.202]) by smtp.gmail.com with ESMTPSA id 29sm7578325lft.43.2016.12.10.12.47.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Dec 2016 12:47:11 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: [RFC PATCH 7/7] KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized Date: Sat, 10 Dec 2016 21:47:12 +0100 Message-Id: <20161210204712.21830-8-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161210204712.21830-1-christoffer.dall@linaro.org> References: <20161210204712.21830-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161210_124733_346290_EA70214F X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:22b listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org If the vgic is not initialized, don't try to grab its spinlocks or traverse its data structures. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.9.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 67d231d..a53e215 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -733,6 +733,9 @@ bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq) struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq); bool map_is_active; + if (!vgic_initialized(vcpu->kvm)) + return false; + DEBUG_SPINLOCK_BUG_ON(!irqs_disabled()); spin_lock(&irq->irq_lock);