diff options
-rw-r--r-- | virt/kvm/eventfd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index decefe944b0f..fe6eb0fe07f6 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c | |||
@@ -405,11 +405,6 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) | |||
405 | if (events & EPOLLIN) | 405 | if (events & EPOLLIN) |
406 | schedule_work(&irqfd->inject); | 406 | schedule_work(&irqfd->inject); |
407 | 407 | ||
408 | /* | ||
409 | * do not drop the file until the irqfd is fully initialized, otherwise | ||
410 | * we might race against the EPOLLHUP | ||
411 | */ | ||
412 | fdput(f); | ||
413 | #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS | 408 | #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS |
414 | if (kvm_arch_has_irq_bypass()) { | 409 | if (kvm_arch_has_irq_bypass()) { |
415 | irqfd->consumer.token = (void *)irqfd->eventfd; | 410 | irqfd->consumer.token = (void *)irqfd->eventfd; |
@@ -425,6 +420,12 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args) | |||
425 | #endif | 420 | #endif |
426 | 421 | ||
427 | srcu_read_unlock(&kvm->irq_srcu, idx); | 422 | srcu_read_unlock(&kvm->irq_srcu, idx); |
423 | |||
424 | /* | ||
425 | * do not drop the file until the irqfd is fully initialized, otherwise | ||
426 | * we might race against the EPOLLHUP | ||
427 | */ | ||
428 | fdput(f); | ||
428 | return 0; | 429 | return 0; |
429 | 430 | ||
430 | fail: | 431 | fail: |