Blame SOURCES/libvirt-virDomainConfNWFilterInstantiate-initialize-xml-to-avoid-random-crash.patch

edecca
From 0f3ca7bcaaec337a672b3a0660c0ceda5f55d807 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <0f3ca7bcaaec337a672b3a0660c0ceda5f55d807@dist-git>
edecca
From: Luyao Huang <lhuang@redhat.com>
edecca
Date: Wed, 11 Jul 2018 17:29:48 +0200
edecca
Subject: [PATCH] virDomainConfNWFilterInstantiate: initialize @xml to avoid
edecca
 random crash
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1599545
edecca
edecca
If the code jump to the cleanup before assigning value to @xml
edecca
libvirtd may crash when it tries to free an uninitialized pointer.
edecca
edecca
backtrace:
edecca
edecca
0  0x00007ffff428d59c in free () from /lib64/libc.so.6
edecca
1  0x00007ffff721314a in virFree (ptrptr=ptrptr@entry=0x7fffc67f1b00) at util/viralloc.c:582
edecca
2  0x00007ffff7345ac4 in virDomainConfNWFilterInstantiate (vmname=<optimized out>,
edecca
   vmuuid=vmuuid@entry=0x7fffc0181ca8 "߉\237\\۔H\262\206z\340\302f\265\233z", net=<optimized out>,
edecca
   ignoreExists=ignoreExists@entry=true) at conf/domain_nwfilter.c:122
edecca
3  0x00007fffca5a77f6 in qemuProcessFiltersInstantiate (ignoreExists=true, def=0x7fffc0181ca0) at qemu/qemu_process.c:3028
edecca
4  qemuProcessReconnect (opaque=<optimized out>) at qemu/qemu_process.c:7653
edecca
5  0x00007ffff72c4895 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
edecca
6  0x00007ffff45dcdd5 in start_thread () from /lib64/libpthread.so.0
edecca
7  0x00007ffff4305ead in clone () from /lib64/libc.so.6
edecca
edecca
Signed-off-by: Luyao Huang <lhuang@redhat.com>
edecca
(cherry picked from commit d7557f5f6f51264c1b5623e97f7b4d5259d4d3b6)
edecca
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 src/conf/domain_nwfilter.c | 2 +-
edecca
 1 file changed, 1 insertion(+), 1 deletion(-)
edecca
edecca
diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
edecca
index 948b32481e..24b5f42ddd 100644
edecca
--- a/src/conf/domain_nwfilter.c
edecca
+++ b/src/conf/domain_nwfilter.c
edecca
@@ -90,7 +90,7 @@ virDomainConfNWFilterInstantiate(const char *vmname,
edecca
     virConnectPtr conn = virGetConnectNWFilter();
edecca
     virNWFilterBindingDefPtr def = NULL;
edecca
     virNWFilterBindingPtr binding = NULL;
edecca
-    char *xml;
edecca
+    char *xml = NULL;
edecca
     int ret = -1;
edecca
 
edecca
     VIR_DEBUG("vmname=%s portdev=%s filter=%s ignoreExists=%d",
edecca
-- 
edecca
2.18.0
edecca