]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Obtain reference on monConfig
authorJohn Ferlan <jferlan@redhat.com>
Fri, 6 Apr 2018 16:14:44 +0000 (12:14 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 10 Apr 2018 12:11:09 +0000 (08:11 -0400)
commita5a777a8bae61cb9e41c4dcd12d2962ad1a65a0d
treef327dde3edb1a444677ccd4686110f460003998c
parent2ada9ef1465f2fd3b9795c0e3f7a2980301289cc
qemu: Obtain reference on monConfig

Because we allow a QEMU_JOB_DESTROY to occur while we're starting
up and we drop the @vm lock prior to qemuMonitorOpen, it's possible
that a domain destroy operation "wins" the race, calls qemuProcessStop
which will free and reinitialize priv->monConfig. Depending on the
exact timing either qemuMonitorOpen will be passed a NULL @config
variable or it will be using free'd (and possibly reclaimed) memory
as the @config parameter - neither of which is good.

Resolve this by localizing the @monConfig, taking an extra reference,
and then once we get the @vm lock again removing our reference since
we are done with it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
src/qemu/qemu_process.c