]> xenbits.xensource.com Git - libvirt.git/commit
qemu: agent: fix unsafe agent access
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Mon, 14 Nov 2016 14:24:23 +0000 (17:24 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Wed, 23 Nov 2016 08:31:28 +0000 (11:31 +0300)
commitaaf2992d90d77eaedd4c186feec417a8606fc897
tree3580fe7d804209c4c0c5d0c3bf1ee9328386c0a9
parent3c1c56781dc9000ba62e6b3a61deebc1b6eb1e6a
qemu: agent: fix unsafe agent access

qemuDomainObjExitAgent is unsafe.

First it accesses domain object without domain lock.
Second it uses outdated logic that goes back to commit 79533da1 of
year 2009 when code was quite different. (unref function
instead of unreferencing only unlocked and disposed object
in case of last reference and leaved unlocking to the caller otherwise).
Nowadays this logic may lead to disposing locked object
i guess.

Another problem is that the callers of qemuDomainObjEnterAgent
use domain object again (namely priv->agent) without domain lock.

This patch address these two problems.

qemuDomainGetAgent is dropped as unused.
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_driver.c