From nobody Sun Feb 8 22:05:17 2026 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=1565189190; cv=none; d=zoho.com; s=zohoarc; b=Es3qP3s6lQo0IIroxVt4csvu0zP0fc94vnbtsMLQysKtWOSFmoXe5c7pKbTkMzmNh+qGfVi/GR9ZrR0N1R4XRQu9pMpmI/96qVC1w9R07LJlOOklAsvFXZiUA55z7Xwqx1cbbFRNh5AUBWSyL2biWoZBc0D5iFzD3qT38YqBSUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565189190; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Y3cn8cJPPjoHsFTMjN2WUYcjT3ojn9zX24x8zYtmq9Q=; b=n8zO1KRsDtywE87FG9wabDLoMWloKABBXtTXfxaeE17wtRM66WWvlsUnqrr4tiV1gQGjkjqUg4VgmJ6/curf4d7vGTN47ab3z8a8G8V5X0Cdl/RC/0s4UcoFSZj+D7EIrXDVCMyC4tiYx6PDxDodQEjJ6mEFaLXfXxZ6PFzkMzI= 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 1565189190731670.4144763188575; Wed, 7 Aug 2019 07:46:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 778AEC05AA61; Wed, 7 Aug 2019 14:46:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C8665D9CD; Wed, 7 Aug 2019 14:46:29 +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 106C92551D; Wed, 7 Aug 2019 14:46:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x77Ejjj5030529 for ; Wed, 7 Aug 2019 10:45:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 544F380224; Wed, 7 Aug 2019 14:45:45 +0000 (UTC) Received: from unknown04D3B0C4CC7D.redhat.com (ovpn-116-53.phx2.redhat.com [10.3.116.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6E826D0B2 for ; Wed, 7 Aug 2019 14:45:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 7 Aug 2019 10:45:41 -0400 Message-Id: <20190807144542.10639-2-jferlan@redhat.com> In-Reply-To: <20190807144542.10639-1-jferlan@redhat.com> References: <20190807144542.10639-1-jferlan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Fix possible NULL deref in qemuDomainGetResctrlMonData 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 07 Aug 2019 14:46:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If virQEMUDriverGetCapabilities returns NULL, then a subsequent deref of @caps would cause an error, so we just return failure. Found by Coverity Signed-off-by: John Ferlan --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f1983f33e6..ff83d1c024 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20728,7 +20728,8 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver, size_t i =3D 0; size_t j =3D 0; =20 - caps =3D virQEMUDriverGetCapabilities(driver, false); + if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) + return -1; =20 switch (tag) { case VIR_RESCTRL_MONITOR_TYPE_CACHE: --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list