From patchwork Mon Dec 4 14:03:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10090343 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 9CEC360329 for ; Mon, 4 Dec 2017 14:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 855ED2899A for ; Mon, 4 Dec 2017 14:04:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A02328D1D; Mon, 4 Dec 2017 14:04:19 +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=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_DBL_ABUSE_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CE0A2899A for ; Mon, 4 Dec 2017 14:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbdLDOER (ORCPT ); Mon, 4 Dec 2017 09:04:17 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38625 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754326AbdLDOD6 (ORCPT ); Mon, 4 Dec 2017 09:03:58 -0500 Received: by mail-wr0-f195.google.com with SMTP id o2so17412932wro.5 for ; Mon, 04 Dec 2017 06:03:57 -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=gPh3kLSoJxKlokQdTT7O24fOf4sHUgGxnERWvytKjlQ=; b=uDnA0zK3UL1zr8uT7rAHK3S8hyO+FGzmbRYNuJh25F0pD7C1Fh59RtXOgMYeOiZ7OX dmEpSLxjfvv7oHeu4JZ/Z3QOVYOpUvZkhTJyyJeKKJvqB/TPJB+pwZyw9+y9NIsD83PD W8Megm7/iuzQio9zFUuboPgJsR0W3oskaYAV3HzbFvFftDhekFxFoyO1vwvQSjUpgDFw CE3tVL0HokzcCL9kYCl+iCaoS4f0empB+wfMXO3x7cMeSbv2Oq790rsiO0wVvwjlMngM jXKDTjxHkidbVCMwEfw4nH5D+ImJpVc0jmgTNEjvYEJERQ8gx32BwLgPU4jxnhMjZa1y PqMQ== 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=gPh3kLSoJxKlokQdTT7O24fOf4sHUgGxnERWvytKjlQ=; b=Poo40g10K3ixsuccIMx8DywqNJMoeiIcweTS4zv1Nrt6Zxe593ExFZde3fOo077xRL nTycGzznO5p+LF/dbamltUKlOQGr35EQh6Zo1DV0qEUbFss6+HTzKQIktdDkzGMU8Ab5 khOSdPv8axTEW4pNMoh3KX5YZbbjnKelUOSUSfK6TPY/6uSY6cZ4JNtlncXlbEK+DCKf XLAWVaOoj4q0Ga3QIkDvl5c3Sn81Bjdp0a6XI6wCmu8y10lqAGEAPnAoSs93fS/wuSXt CmAUDVnPhMSSlHktWhmHq17Icz/qJigje4UAEsdHCIpi8A51R5cUpXTcRFgy3bARe532 US/w== X-Gm-Message-State: AJaThX7nX0s2OxvOJWjT6BTzKrTZVzLYaXZi2AzPb3TfzhhVWhiAzape OepopaPEM9Ko+hF+LmMBsuKIKQ== X-Google-Smtp-Source: AGs4zMaV3oZUoFgX5SbJZoyxHULYnSf5jWg+CQ6D0Wj9WcmgN36eel8hb5HP0vMNrMHNXQkHKPzf3g== X-Received: by 10.223.178.87 with SMTP id y23mr12242242wra.3.1512396236835; Mon, 04 Dec 2017 06:03:56 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g7sm22794279wra.38.2017.12.04.06.03.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Dec 2017 06:03:56 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PULL 07/19] KVM: arm/arm64: vgic-v4: Only perform an unmap for valid vLPIs Date: Mon, 4 Dec 2017 15:03:36 +0100 Message-Id: <20171204140348.21965-5-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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier Before performing an unmap, let's check that what we have was really mapped the first place. Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-v4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c index 53c324aa44ef..4a37292855bc 100644 --- a/virt/kvm/arm/vgic/vgic-v4.c +++ b/virt/kvm/arm/vgic/vgic-v4.c @@ -337,8 +337,10 @@ int kvm_vgic_v4_unset_forwarding(struct kvm *kvm, int virq, goto out; WARN_ON(!(irq->hw && irq->host_irq == virq)); - irq->hw = false; - ret = its_unmap_vlpi(virq); + if (irq->hw) { + irq->hw = false; + ret = its_unmap_vlpi(virq); + } out: mutex_unlock(&its->its_lock);