aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/irq_comm.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2008-12-01 08:57:46 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:55:06 -0500
commitfdd897e6b5253a45b633f7d334cf3e150bbaf386 (patch)
tree2a6d5c59d782c49f20d01578525eb9ec201bb35a /virt/kvm/irq_comm.c
parent844c7a9ff404d8fc88bb77b06461644621d2c985 (diff)
KVM: make kvm_unregister_irq_ack_notifier() safe
We never pass a NULL notifier pointer here, but we may well pass a notifier struct which hasn't previously been registered. Guard against this by using hlist_del_init() which will not do anything if the node hasn't been added to the list and, when removing the node, will ensure that a subsequent call to hlist_del_init() will be fine too. Fixes an oops seen when an assigned device is freed before and IRQ is assigned to it. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm/irq_comm.c')
-rw-r--r--virt/kvm/irq_comm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 973df997ea60..db75045f22f6 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -63,9 +63,7 @@ void kvm_register_irq_ack_notifier(struct kvm *kvm,
63 63
64void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian) 64void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian)
65{ 65{
66 if (!kian) 66 hlist_del_init(&kian->link);
67 return;
68 hlist_del(&kian->link);
69} 67}
70 68
71/* The caller must hold kvm->lock mutex */ 69/* The caller must hold kvm->lock mutex */