[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH V9 2/3] Introduce file descriptor set for QEMU domains



On 03/07/2013 11:14 AM, Stefan Berger wrote:
> Extend the QEMU private domain structure with virFdSet.
> Persist the virFdSet using XML and parse its XML.
> Free the FdSet upon domain stop.
> 
> Signed-off-by: Stefan Berger <stefanb linux vnet ibm com>
> 
> ---

> Index: libvirt/src/qemu/qemu_domain.c
> ===================================================================
> --- libvirt.orig/src/qemu/qemu_domain.c
> +++ libvirt/src/qemu/qemu_domain.c
> @@ -252,6 +252,7 @@ static void qemuDomainObjPrivateFree(voi
>          qemuAgentClose(priv->agent);
>      }
>      VIR_FREE(priv->cleanupCallbacks);
> +    virObjectUnref(priv->fdset);
>      VIR_FREE(priv);
>  }
>  
> @@ -326,6 +327,10 @@ static int qemuDomainObjPrivateXMLFormat
>      if (priv->fakeReboot)
>          virBufferAsprintf(buf, "  <fakereboot/>\n");
>  
> +    virBufferAdjustIndent(buf, 2);
> +    virFdSetFormatXML(priv->fdset, buf);

Oops - potential NULL deref - virFdSetParseXML requires a non-null arg,
but you haven't yet added in the code that guarantees that priv->fdset
exists on a running domain (and for an offline domain, you are
intentionally leaving priv->fdset NULL).

Still, I can fix it, so ACK, and no need to send a v10, depending on how
3/3 fares:

diff --git i/src/qemu/qemu_domain.c w/src/qemu/qemu_domain.c
index cfd4b8e..22c7ade 100644
--- i/src/qemu/qemu_domain.c
+++ w/src/qemu/qemu_domain.c
@@ -327,9 +327,11 @@ static int
qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
     if (priv->fakeReboot)
         virBufferAsprintf(buf, "  <fakereboot/>\n");

-    virBufferAdjustIndent(buf, 2);
-    virFdSetFormatXML(priv->fdset, buf);
-    virBufferAdjustIndent(buf, -2);
+    if (priv->fdset) {
+        virBufferAdjustIndent(buf, 2);
+        virFdSetFormatXML(priv->fdset, buf);
+        virBufferAdjustIndent(buf, -2);
+    }

     return 0;
 }

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]