From nobody Fri Mar 29 10:42:45 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 ARC-Seal: i=1; a=rsa-sha256; t=1559828704; cv=none; d=zoho.com; s=zohoarc; b=BEW7qKpdf0sThEWs7dVMOrJrQxn/R2eb2Ii4W2HustkNL8XzTmH4MPSlFN15+zelRnjaiq9ljNbMUvYBX4wTqDncoQaZ+FHyD8742L2dl2oaMxlV1kM81RzpMn0Uzy4tfSi48Dtg3DUHB8tWtwVJkC4zv1CLtW1VOKPDh/8bHwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559828704; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=VTVSo09W/8MkrXcMPNWh4RGdaZBVWZ+jGJSUfi6v6N8=; b=R9l1FQq/ys9xCPCfK+dI/ZzGlnoCUlJzdIfPIt+RcFtX69v5Z0rpCtT2RIb3VW3M3cR2zCGJnoXceUOIoaSSLqNXJigcoVSmVl8TSbh014JLRg0yQkZBAibuv5e7G8rSjWJkrUgbBZ1JNvyLxy9VkrO0K8Id8uL/PCjnAcNX9pg= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559828704107976.7855842014139; Thu, 6 Jun 2019 06:45:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 725BB18DF7A; Thu, 6 Jun 2019 13:44:47 +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 1D9D97D670; Thu, 6 Jun 2019 13:44:43 +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 AE0711833004; Thu, 6 Jun 2019 13:44:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x56DicSH017376 for ; Thu, 6 Jun 2019 09:44:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F92817B25; Thu, 6 Jun 2019 13:44:38 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD645819E for ; Thu, 6 Jun 2019 13:44:34 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 6 Jun 2019 15:44:33 +0200 Message-Id: <20190606134433.4368-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Fix NULL pointer access in qemuProcessInitCpuAffinity() 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-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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 06 Jun 2019 13:44:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 2f2254c7f4e5 attempted to fix a memory leak by ensuring cpumapToSet is always a freshly allocated bitmap, but regrettably introduced a NULL pointer access while doing so, because it called virBitmapCopy() without allocating the destination bitmap first. Solve the issue by using virBitmapNewCopy() instead. Reported-by: John Ferlan Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 42a6271411..50a76aa0ed 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2498,7 +2498,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm) if (virNumaNodesetToCPUset(nodeset, &cpumapToSet) < 0) return -1; } else if (vm->def->cputune.emulatorpin) { - if (virBitmapCopy(cpumapToSet, vm->def->cputune.emulatorpin) < 0) + if (!(cpumapToSet =3D virBitmapNewCopy(vm->def->cputune.emulatorpi= n))) return -1; } else { if (qemuProcessGetAllCpuAffinity(&cpumapToSet) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list