KVM: arm/arm64: vgic-v4: Only perform an unmap for valid vLPIs
authorMarc Zyngier <marc.zyngier@arm.com>
Thu, 16 Nov 2017 17:58:19 +0000 (17:58 +0000)
committerChristoffer Dall <christoffer.dall@linaro.org>
Wed, 29 Nov 2017 15:46:16 +0000 (16:46 +0100)
Before performing an unmap, let's check that what we have was
really mapped the first place.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/vgic/vgic-v4.c

index 53c324a..4a37292 100644 (file)
@@ -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);