]> xenbits.xensource.com Git - libvirt.git/commit
qemu_agent: Remove agent reference only when disposing it
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 9 Jan 2013 11:33:45 +0000 (12:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 10 Jan 2013 09:32:54 +0000 (10:32 +0100)
commitf2a4e5f176c408fd2db79ed08b2a7d32a52d35a2
tree348f8dcd7e25d9067e61477b6d7ceb367b7989ef
parentdaef7c9e9c5abef65e77116a1cabad37c0c0a897
qemu_agent: Remove agent reference only when disposing it

https://bugzilla.redhat.com/show_bug.cgi?id=892079

With current code, if user calls virDomainPMSuspendForDuration()
followed by virDomainDestroy(), the former API checks for qemu agent
presence, which will evaluate as true (if agent is configured). While
talking to qemu agent, the qemu driver is unlocked, so the latter API
starts executing.  However, if machine dies meanwhile, libvirtd gets
EOF on the agent socket and qemuProcessHandleAgentEOF() is called. The
handler clears reference to qemu agent while the destroy API already
holding a reference to it. This leads to NULL dereferencing later in
the code. Therefore, the agent pointer should be set to NULL only if
we are the exclusive owner of it.
src/qemu/qemu_process.c