From: Marc Zyngier Date: Thu, 16 Nov 2017 17:58:19 +0000 (+0000) Subject: KVM: arm/arm64: vgic-v4: Only perform an unmap for valid vLPIs X-Git-Tag: v4.19~2003^2~6^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a05d1c0d03fd60ed487991e73850421e735c0135;p=platform%2Fkernel%2Flinux-rpi.git KVM: arm/arm64: vgic-v4: Only perform an unmap for valid vLPIs 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 --- diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c index 53c324a..4a37292 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);