From nobody Thu May 16 21:49:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530765268247131.93701370504823; Wed, 4 Jul 2018 21:34:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A69C313A82; Thu, 5 Jul 2018 04:34:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE39C60BE7; Thu, 5 Jul 2018 04:34:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8E6D918052E9; Thu, 5 Jul 2018 04:34:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w654YGNP013688 for ; Thu, 5 Jul 2018 00:34:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id A362E202704E; Thu, 5 Jul 2018 04:34:16 +0000 (UTC) Received: from lhuang.nay.redhat.com (unknown [10.66.6.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DF582027047; Thu, 5 Jul 2018 04:34:15 +0000 (UTC) From: Luyao Huang To: libvir-list@redhat.com Date: Thu, 5 Jul 2018 12:34:11 +0800 Message-Id: <1530765251-5291-1-git-send-email-lhuang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Luyao Huang Subject: [libvirt] [PATCH] conf: initialize character pointer xml value to avoid random crash X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 05 Jul 2018 04:34:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 If the code jump to the cleanup before assagin value to xml pointer, libvirtd may get crashed when try to free an uninitialized pointer. backtrace: 0 0x00007ffff428d59c in free () from /lib64/libc.so.6 1 0x00007ffff721314a in virFree (ptrptr=3Dptrptr@entry=3D0x7fffc67f1b00) a= t util/viralloc.c:582 2 0x00007ffff7345ac4 in virDomainConfNWFilterInstantiate (vmname=3D, vmuuid=3Dvmuuid@entry=3D0x7fffc0181ca8 "=DF=89\237\\=DB=94H\262\206z\340= \302f\265\233z", net=3D, ignoreExists=3DignoreExists@entry=3Dtrue) at conf/domain_nwfilter.c:122 3 0x00007fffca5a77f6 in qemuProcessFiltersInstantiate (ignoreExists=3Dtrue= , def=3D0x7fffc0181ca0) at qemu/qemu_process.c:3028 4 qemuProcessReconnect (opaque=3D) at qemu/qemu_process.c:7= 653 5 0x00007ffff72c4895 in virThreadHelper (data=3D) at util/v= irthread.c:206 6 0x00007ffff45dcdd5 in start_thread () from /lib64/libpthread.so.0 7 0x00007ffff4305ead in clone () from /lib64/libc.so.6 Signed-off-by: Luyao Huang --- src/conf/domain_nwfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c index 948b324..24b5f42 100644 --- a/src/conf/domain_nwfilter.c +++ b/src/conf/domain_nwfilter.c @@ -90,7 +90,7 @@ virDomainConfNWFilterInstantiate(const char *vmname, virConnectPtr conn =3D virGetConnectNWFilter(); virNWFilterBindingDefPtr def =3D NULL; virNWFilterBindingPtr binding =3D NULL; - char *xml; + char *xml =3D NULL; int ret =3D -1; =20 VIR_DEBUG("vmname=3D%s portdev=3D%s filter=3D%s ignoreExists=3D%d", --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list