[lkml]   [2008]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 15/36] KVM: make kvm_unregister_irq_ack_notifier() safe
From: Mark McLoughlin <>

We never pass a NULL notifier pointer here, but we may well
pass a notifier struct which hasn't previously been

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 <>
Signed-off-by: Avi Kivity <>
virt/kvm/irq_comm.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 973df99..db75045 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,

void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian)
- if (!kian)
- return;
- hlist_del(&kian->link);
+ hlist_del_init(&kian->link);

/* The caller must hold kvm->lock mutex */

 \ /
  Last update: 2008-12-14 09:15    [W:0.099 / U:3.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site