]> git.ipfire.org Git - thirdparty/libvirt.git/commit
event: fix event-handling data race
authorEric Blake <eblake@redhat.com>
Fri, 21 Jan 2011 19:57:03 +0000 (12:57 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 21 Jan 2011 22:54:54 +0000 (15:54 -0700)
commita11bd2e6cc267febc3de9047a1aa317a2f52d81d
treef4c18f27160c6b299d69237507359ebf92c59012
parentae0cdd471041bc33591c7db67f9a12f2ad5d6db3
event: fix event-handling data race

This bug has been present since before the time that commit
f8a519 (Dec 2008) tried to make the dispatch loop re-entrant.

Dereferencing eventLoop.handles outside the lock risks crashing, since
any other thread could have reallocated the array in the meantime.
It's a narrow race window, however, and one that would have most
likely resulted in passing bogus data to the callback rather than
actually causing a segv, which is probably why it has gone undetected
this long.

* daemon/event.c (virEventDispatchHandles): Cache data while
inside the lock, as the array might be reallocated once outside.
daemon/event.c