[libvirt] [PATCH] conf: don't crash on a tpm device with no backends
Daniel P. Berrange
berrange at redhat.com
Thu May 9 10:41:57 UTC 2013
On Thu, May 09, 2013 at 12:36:37PM +0200, Ján Tomko wrote:
> 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"));
Add a test case please.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list