]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: irqfd: fix race between EPOLLHUP and irq_bypass_register_consumer
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 May 2018 11:31:13 +0000 (13:31 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Jul 2018 09:31:27 +0000 (11:31 +0200)
commit34629353ce418b2090cfdf6c088e6ceae4a9a434
tree13f5e44fdcc83b3b5fdc7607290064130af84853
parent8d76481edb5647dd848dabc0c4451b7baf9793f8
KVM: irqfd: fix race between EPOLLHUP and irq_bypass_register_consumer

A comment warning against this bug is there, but the code is not doing what
the comment says.  Therefore it is possible that an EPOLLHUP races against
irq_bypass_register_consumer.  The EPOLLHUP handler schedules irqfd_shutdown,
and if that runs soon enough, you get a use-after-free.

Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
virt/kvm/eventfd.c