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: 10090375 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 2799160329 for ; Mon, 4 Dec 2017 14:06:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FF8B2842D for ; Mon, 4 Dec 2017 14:06:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0416D2877F; Mon, 4 Dec 2017 14:06: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 5CA212842D for ; Mon, 4 Dec 2017 14:06:09 +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=fvM8j5t51trTXVI4NZQv1a0bG+3j9QZgRj//2JDBt3c=; b=MtkHpJ68lWrp8cqgaEPueKCqup +00m7RMNkp1OzISEMie+uzQ5JXc9RUqaBAX+iZi7vzUWqSfY789NbZftSYzSrU5FkyQWpY3GPOgoS 4GW8dvOvzuNeEp2GIawbDf/dtLz2ERFsArbpyVkzhP7cZkCwugLEXCKqZbaQuXCUZz3jcK1dVAmQS haq8TXwwmvFCwwH5EI8W35gcISd5XKV59XOCTparFejWBh1wTU28xF/3qfEB79O3kPW1qR2jhGUfB 0mgKEMZExLYEWI7wmPy9wSF/YzeYcN+q72TYjRYFQ7K5Z0qDeY+tBKN2sx266hi4Sm49VH5aQSVuW nTulxguw==; 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 1eLrNo-0005aA-FM; Mon, 04 Dec 2017 14:06:08 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLrM1-0002O2-It for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 14:04:27 +0000 Received: by mail-wr0-x243.google.com with SMTP id z18so17450306wrb.8 for ; Mon, 04 Dec 2017 06:03:58 -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=pBESjwwIS8Mnq7vvDpZ05Y24UXoNYIGFKH0BS5Bltz1if26TnwKf2WXsjjLpKMZ6/7 q+T32FYqDBrAIgyoTss1s4O/h30LzzbNnyD9ASVps5a8QIOVEClnpigxiIfy9vLYRWAE Umu3TayafZQ3BX9LyhFxT/1jkr6ezCYgdZAIOzKrFc/tDdHLiU4d7pezHhQgKRH4GhQ1 lyQYo2x94MrRos05H2n2S5zo7afFymEcT5etCBpF13UQ++4Ng9mvpEjuvi5dzQPgjlN8 wc3kQwnFPI2Vp/sjyDxoeGaadBkXCgRmUixFeLGghJSLez0KgzljjjZ8z4XTr2Cs+yoC iKeg== X-Gm-Message-State: AJaThX63vetbnk3T+fZbF4AFMJQxOtHJ0EcCbUBavNSUOimJILMRfxBP Wjrss+bn+lODO0ZqCRXpXzKy2Q== 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_060417_907313_BC04B519 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. 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 , 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: 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);