[libvirt] [PATCH] xenconfig: fix xml conversion convert with no graphics

Joao Martins posted 1 patch 148 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1486557156-6585-1-git-send-email-joao.m.martins@oracle.com
src/xenconfig/xen_xl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[libvirt] [PATCH] xenconfig: fix xml conversion convert with no graphics

Posted by Joao Martins 148 weeks ago
If no graphics element is in XML xenFormatXLSpice will access
graphics without checking it has one in the first place, leading to a
segmentation fault.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 src/xenconfig/xen_xl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 2c9174e..74f68b3 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1168,7 +1168,7 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
     virDomainGraphicsListenDefPtr glisten;
     virDomainGraphicsDefPtr graphics;
 
-    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
+    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && def->graphics) {
         graphics = def->graphics[0];
 
         if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
-- 
2.1.4

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

Re: [libvirt] [PATCH] xenconfig: fix xml conversion convert with no graphics

Posted by Jim Fehlig 148 weeks ago
Joao Martins wrote:
> If no graphics element is in XML xenFormatXLSpice will access
> graphics without checking it has one in the first place, leading to a
> segmentation fault.
> 
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>

ACK. I changed the commit description to "xenconfig: fix xml to xl.cfg
conversion with no graphics" and pushed the patch. Thanks!

Regards,
Jim

> ---
>  src/xenconfig/xen_xl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> index 2c9174e..74f68b3 100644
> --- a/src/xenconfig/xen_xl.c
> +++ b/src/xenconfig/xen_xl.c
> @@ -1168,7 +1168,7 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
>      virDomainGraphicsListenDefPtr glisten;
>      virDomainGraphicsDefPtr graphics;
>  
> -    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
> +    if (def->os.type == VIR_DOMAIN_OSTYPE_HVM && def->graphics) {
>          graphics = def->graphics[0];
>  
>          if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {

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