[PATCH 1/3] qemuDomainGetGuestInfo: Exit early if getting info fails

Michal Privoznik mprivozn at redhat.com
Tue Dec 1 11:50:14 UTC 2020


If there is an error getting info from guest agent, then the
control on qemuDomainGetGuestInfo() jumps onto 'exitagent' label
and subsequently continues on 'endagentjob'. Both labels are hit
also in success case, which is why there is a code that tries to
match info obtained from the guest agent with domain definition.
However, if we know that we've reached this area because of an
error (ret = -1) there is no reason for us to attempt finding the
match as the API as whole will end up with an error.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2d4b5a8b99..338c609854 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20129,6 +20129,9 @@ qemuDomainGetGuestInfo(virDomainPtr dom,
  endagentjob:
     qemuDomainObjEndAgentJob(vm);
 
+    if (ret < 0)
+        goto cleanup;
+
     if (nfs > 0 || ndisks > 0) {
         if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
             goto cleanup;
-- 
2.26.2




More information about the libvir-list mailing list