KVM: fix irqfd assign/deassign race
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 14 Oct 2010 16:49:58 +0000 (13:49 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 29 Oct 2010 04:51:38 +0000 (21:51 -0700)
commit85aa4285872f67bb21ecf7de0e467c57b4c6a976
treeafc4dd414856b7a47ada280a6c409b3a2ce1ec1c
parentd25faf3214b1991531f2ef64b864751b002fcf8f
KVM: fix irqfd assign/deassign race

commit 6bbfb2653177a00f70e57e53625502d43804fed0 upstream.

I think I see the following (theoretical) race:

During irqfd assign, we drop irqfds lock before we
schedule inject work. Therefore, deassign running
on another CPU could cause shutdown and flush to run
before inject, causing user after free in inject.

A simple fix it to schedule inject under the lock.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
virt/kvm/eventfd.c