KVM: use rcu access function for irq routing
authorChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 6 Jul 2017 18:31:11 +0000 (20:31 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 7 Jul 2017 13:24:15 +0000 (15:24 +0200)
irq routing is rcu protected. Use the proper access functions.
Found by sparse

virt/kvm/irqchip.c:233:13: warning: incorrect type in assignment (different address spaces)
virt/kvm/irqchip.c:233:13:    expected struct kvm_irq_routing_table *old
virt/kvm/irqchip.c:233:13:    got struct kvm_irq_routing_table [noderef] <asn:4>*irq_routing

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/irqchip.c

index 31e40c9e81df41de6f8cadb076515677ac5cae9c..b1286c4e0712259fac5d66b9bbc3aaf388d3d3f9 100644 (file)
@@ -230,7 +230,7 @@ int kvm_set_irq_routing(struct kvm *kvm,
        }
 
        mutex_lock(&kvm->irq_lock);
-       old = kvm->irq_routing;
+       old = rcu_dereference_protected(kvm->irq_routing, 1);
        rcu_assign_pointer(kvm->irq_routing, new);
        kvm_irq_routing_update(kvm);
        kvm_arch_irq_routing_update(kvm);