[PATCH] conf: don't crash on a tpm device with no backends

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

 



Print an error instead of crashing when a TPM device without
a backend is specified.

https://bugzilla.redhat.com/show_bug.cgi?id=961252
---
 src/conf/domain_conf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d55ce6b..eb579c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6988,6 +6988,12 @@ virDomainTPMDefParseXML(const xmlNodePtr node,
         goto error;
     }
 
+    if (nbackends == 0) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("missing TPM device backend"));
+        goto error;
+    }
+
     if (!(backend = virXMLPropString(backends[0], "type"))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("missing TPM device backend type"));
-- 
1.8.1.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]