aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/irq_comm.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/irq_comm.c')
-rw-r--r--virt/kvm/irq_comm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 55ad76ee2d09..aa5d1e5c497e 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -61,10 +61,9 @@ void kvm_register_irq_ack_notifier(struct kvm *kvm,
61 hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list); 61 hlist_add_head(&kian->link, &kvm->arch.irq_ack_notifier_list);
62} 62}
63 63
64void kvm_unregister_irq_ack_notifier(struct kvm *kvm, 64void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian)
65 struct kvm_irq_ack_notifier *kian)
66{ 65{
67 hlist_del(&kian->link); 66 hlist_del_init(&kian->link);
68} 67}
69 68
70/* The caller must hold kvm->lock mutex */ 69/* The caller must hold kvm->lock mutex */
@@ -73,11 +72,15 @@ int kvm_request_irq_source_id(struct kvm *kvm)
73 unsigned long *bitmap = &kvm->arch.irq_sources_bitmap; 72 unsigned long *bitmap = &kvm->arch.irq_sources_bitmap;
74 int irq_source_id = find_first_zero_bit(bitmap, 73 int irq_source_id = find_first_zero_bit(bitmap,
75 sizeof(kvm->arch.irq_sources_bitmap)); 74 sizeof(kvm->arch.irq_sources_bitmap));
75
76 if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) { 76 if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
77 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n"); 77 printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
78 irq_source_id = -EFAULT; 78 return -EFAULT;
79 } else 79 }
80 set_bit(irq_source_id, bitmap); 80
81 ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID);
82 set_bit(irq_source_id, bitmap);
83
81 return irq_source_id; 84 return irq_source_id;
82} 85}
83 86
@@ -85,7 +88,9 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
85{ 88{
86 int i; 89 int i;
87 90
88 if (irq_source_id <= 0 || 91 ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID);
92
93 if (irq_source_id < 0 ||
89 irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) { 94 irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
90 printk(KERN_ERR "kvm: IRQ source ID out of range!\n"); 95 printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
91 return; 96 return;