From patchwork Mon Dec 4 13:56:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10090309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D818E6056E for ; Mon, 4 Dec 2017 13:57:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD94F29035 for ; Mon, 4 Dec 2017 13:57:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B260A2912D; Mon, 4 Dec 2017 13:57:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43B6F29035 for ; Mon, 4 Dec 2017 13:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=RvO/QfYyFztbWnd/3ykUvWCAHaVFaVVg67SOmGyhLq8=; b=jxdRrZIDfrjVp3Q2HHv2Voyt82 VeDUogBhK6evlKZpw+XO+qDO5gbgzgqoxddR/rtOy3Brkwv/SFU0HF9Z7aYZwHNXtLfuXi0hYvHBI AAh44y5GMjk/Z+U94Rgp47Nd5hPxoR+jmlM37vtcxXtoFPkcmV2LGMi9v7GRrgQNzhNDG5mbPzK6x K6YiX26fenBkdBQ0CPNW2f3HtxSCyknJ4iReVf2OchV0EGRdr1FU2Q1Ff+lh2mf5A9EEWvEgI95vr PyQo90q1+5tjyRm6YB3ZcW6QS8PfOcliZUF6GNLzo5xeZzh/PgFhuQ6AaP39Mt+uJkwwzmxzvD1d+ mscjv8Sw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLrF7-0007rm-O7; Mon, 04 Dec 2017 13:57:09 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrEx-0007aF-KE for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 13:57:07 +0000 Received: by mail-wr0-x242.google.com with SMTP id l22so17379372wrc.11 for ; Mon, 04 Dec 2017 05:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZT5oglIYnM/6cguB+N6ZgO9xTgV+yE8P1fliJQG4/90=; b=aTE/+SkE0AmuEMSRgKXwN3sg7KM8uz5B04eC3CiXQgLODa4IR+/p1fso+jVRrP3V+9 1XfZUuK1BPNlVmANFc4JWihbnQWL2GkV1U6q6cWP5u1cf9ZI5fowwLpZBl67w7e3S1AX X059nzIUA7mrUzNFWKLLfzUbDB0F7Ss4f5SI/dLbBLZez87637+2mD8vhl/IiN4/+pRR kiQV1LN+QHFGx1pTXcSuycoinQWrVFZ/Jq3X0KFjSuHTTc8ydOShqeS9auNhWZxYCBdE Oc8F3QRDnTtLbhekQN/VuXHfoiTV2dKX0MI4I4N5YI7gH41OD32ItBRaYW1yccZ+D3ET HFag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ZT5oglIYnM/6cguB+N6ZgO9xTgV+yE8P1fliJQG4/90=; b=VVCD+hNI1dlkafzn2FOjL2gemp+fSSlRKxCy6YVg//3qiPC0AP34NCTw+ruk+Ta/3f HJ7eCaTVvbJmveMAD3qZNP4YtsPR5Nl6ELc1drMoJHoguFH68MdQdViZH+HF0g60jcXD 1fR2JGUTRR0ZjzOjcwjW4n6HPmHSqyS0+/8YwDOytqTrDo51t7UOcQTksD52Uzxi6Yev UQ/FoZ8z5OinrErO7WPaqE8jtoMpYLeJWXL7jgcBAy4++PokTqa7Xg5AIDb3oy3IJYxq y/s5hhcplG2AsbFv0cTg35WEVeUKCa59OW5EFx0wySEvOdBvPzObVw7187BbT9INfyCk AZJA== X-Gm-Message-State: AKGB3mKdqOD1IduA44wPxiMkT5zHEOfv3CYZyz18eWoRqmb+Pa7IeRdw t0hhiqYL39Dwz3u9lyL02cqykA== X-Google-Smtp-Source: AGs4zMb17cVEQstGrX5jvy05djVL2wE5/JSqU3HF7CF3V3RsAX0n/OSKfjGSiifMW9VwF0sGwP4ufQ== X-Received: by 10.223.187.3 with SMTP id r3mr6279465wrg.34.1512395800562; Mon, 04 Dec 2017 05:56:40 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id o27sm12056103wro.9.2017.12.04.05.56.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 05:56:39 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 02/19] KVM: arm/arm64: VGIC: extend !vgic_is_initialized guard Date: Mon, 4 Dec 2017 14:56:20 +0100 Message-Id: <20171204135637.21620-3-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171204135637.21620-1-cdall@kernel.org> References: <20171204135637.21620-1-cdall@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_055700_361077_8D1E585C X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Andre Przywara , Christoffer Dall , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andre Przywara Commit f39d16cbabf9 ("KVM: arm/arm64: Guard kvm_vgic_map_is_active against !vgic_initialized") introduced a check whether the VGIC has been initialized before accessing the spinlock and the VGIC data structure. However the vgic_get_irq() call in the variable declaration sneaked through the net, so lets make sure that this also gets called only after we actually allocated the arrays this function accesses. Reviewed-by: Eric Auger Signed-off-by: Andre Przywara Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index b168a328a9e0..786cce7bd2ec 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -823,13 +823,14 @@ void vgic_kick_vcpus(struct kvm *kvm) bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid) { - struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, vintid); + struct vgic_irq *irq; bool map_is_active; unsigned long flags; if (!vgic_initialized(vcpu->kvm)) return false; + irq = vgic_get_irq(vcpu->kvm, vcpu, vintid); spin_lock_irqsave(&irq->irq_lock, flags); map_is_active = irq->hw && irq->active; spin_unlock_irqrestore(&irq->irq_lock, flags);