From nobody Thu Apr 25 07:03:32 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 ARC-Seal: i=1; a=rsa-sha256; t=1555353043; cv=none; d=zoho.com; s=zohoarc; b=RLGfFHYpQGQ9+oje7e8qOuSxmI3lFaaqTlUaMq8AvFe8rhRssTKQEXD4SbyFgYkgKMnUsXmQKe4c7q0hqXWjGMVnAZtX50NZBKva768kvZtsiKCqmPz5DUyqVdbyHkM6iQM/fZJ7kwz17aCJqI0UQ7MopwmRY5JViHynGJFGaPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555353043; h=Content-Type:Content-Transfer-Encoding:Cc: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=l8u6v36Zfw+BHEQyhd9Mjku7595c0HQYPgsW82BR6Vc=; b=FrgFkTX+1MUkZ8CF9lceITgi1UmBXlZUVZ8IPGTCuoq/1teyqu4KHnmsQ9Hzv0dYw6qhTej/z156GasFhShlkc/giV/GDJpIq4ownEUqZNNtMk8xMSfGHb34NxmszwsRz9tnbsXu90b5eX2jgQsnj1Z4Y8VgcNGSSnHEfkvL0/0= 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555353043460327.3107668612531; Mon, 15 Apr 2019 11:30:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF32D3199365; Mon, 15 Apr 2019 18:30:41 +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 8530F19C7C; Mon, 15 Apr 2019 18:30:41 +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 44A713D86; Mon, 15 Apr 2019 18:30:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3FIUV7X030602 for ; Mon, 15 Apr 2019 14:30:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6A56E5D710; Mon, 15 Apr 2019 18:30:31 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 653EC5D707 for ; Mon, 15 Apr 2019 18:30:29 +0000 (UTC) Received: from zimbra.eo.pl (zimbra.eo.pl [217.17.46.141]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFEE38831E for ; Mon, 15 Apr 2019 18:30:08 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailfe1.internal (Postfix) with ESMTP id 1945D89499; Mon, 15 Apr 2019 20:29:59 +0200 (CEST) Received: from zimbra.eo.pl ([127.0.0.1]) by localhost (mailfe1.internal [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id au1SmtTbKB83; Mon, 15 Apr 2019 20:29:58 +0200 (CEST) Received: from kvm221.tbg.eo.pl (gnl93.internetdsl.tpnet.pl [83.3.89.93]) by mailfe1.internal (Postfix) with ESMTPSA id C47E589498; Mon, 15 Apr 2019 20:29:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at eo.pl From: Adrian Brzezinski To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 20:29:42 +0200 Message-Id: <1555352983-1040-2-git-send-email-adrian.brzezinski@eo.pl> In-Reply-To: <1555352983-1040-1-git-send-email-adrian.brzezinski@eo.pl> References: <1555085449-1835-1-git-send-email-adrian.brzezinski@eo.pl> <1555352983-1040-1-git-send-email-adrian.brzezinski@eo.pl> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 Apr 2019 18:30:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 Apr 2019 18:30:17 +0000 (UTC) for IP:'217.17.46.141' DOMAIN:'zimbra.eo.pl' HELO:'zimbra.eo.pl' FROM:'adrian.brzezinski@eo.pl' RCPT:'' X-RedHat-Spam-Score: -0.01 (RCVD_IN_DNSWL_NONE) 217.17.46.141 zimbra.eo.pl 217.17.46.141 zimbra.eo.pl X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Adrian Brzezinski , Adrian Brzezinski Subject: [libvirt] [PATCH v2 1/2] rpc: cleanup in virNetTLSContextNew 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 15 Apr 2019 18:30:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Failed new gnutls context allocations in virNetTLSContextNew function results in double free and segfault. Occasional memory leaks may also occur. Signed-off-by: Adrian Brzezinski --- src/rpc/virnettlscontext.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 72e9ed9..7b5d578 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -707,6 +707,12 @@ static virNetTLSContextPtr virNetTLSContextNew(const c= har *cacert, =20 err =3D gnutls_certificate_allocate_credentials(&ctxt->x509cred); if (err) { + /* gnutls_certificate_credentials_t is complex structure with multi= ple + * internal memory allocatons that can go wrong, so make sure that + * reference is NULL. + */ + ctxt->x509cred =3D NULL; + virReportError(VIR_ERR_SYSTEM_ERROR, _("Unable to allocate x509 credentials: %s"), gnutls_strerror(err)); @@ -758,7 +764,9 @@ static virNetTLSContextPtr virNetTLSContextNew(const ch= ar *cacert, error: if (isServer) gnutls_dh_params_deinit(ctxt->dhParams); - gnutls_certificate_free_credentials(ctxt->x509cred); + if (ctxt->x509cred) + gnutls_certificate_free_credentials(ctxt->x509cred); + VIR_FREE(ctxt->priority); VIR_FREE(ctxt); return NULL; } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 07:03:32 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 ARC-Seal: i=1; a=rsa-sha256; t=1555353036; cv=none; d=zoho.com; s=zohoarc; b=SEgoF3ZGQMTTZeEK6BUAX20ZXGsUpb2ROG//Bgmcik3bFgm2eheD9h/xfoADZGKNcwCXQWqfjQQD/tta8wsraeU2yC4lCnWa9qvPQbQ0fZbsN12IBRtnObSs3mjYLBPUn3+g0Tnvs5pgWmZXDw1O+W1TmMEhWGsM3AdbH5uOTu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555353036; h=Content-Type:Content-Transfer-Encoding:Cc: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=ShEYF4N8snxpVTIfZW0oAP/Okfjnvaz1EIt2OYcRoDg=; b=law6EOJpNF7xQ1O4BByALs1Yo/ugvbtEbDnyDSVPRsGVTcNCG8RF0S1UUv7UlY1sRwpe09q41o4Kv4HhjZ0OhlP7Na5DcOY26wefrfeh7cIxxf/5eT5eEbP+5WLc7+ozD43k3shtxfTmnfU4G1mUemjfZFPMhbGUCZ3ZUhJnXEY= 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555353036713839.9351285115633; Mon, 15 Apr 2019 11:30:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A1F4D19D05E; Mon, 15 Apr 2019 18:30:34 +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 4FB921001DDD; Mon, 15 Apr 2019 18:30:34 +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 43929181AC45; Mon, 15 Apr 2019 18:30:33 +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 x3FIUUfu030592 for ; Mon, 15 Apr 2019 14:30:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id F29F05D9CA; Mon, 15 Apr 2019 18:30:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EE5B85D9C9 for ; Mon, 15 Apr 2019 18:30:27 +0000 (UTC) Received: from zimbra.eo.pl (zimbra.eo.pl [217.17.46.141]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E80B30842CE for ; Mon, 15 Apr 2019 18:30:10 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailfe1.internal (Postfix) with ESMTP id CABA38949A; Mon, 15 Apr 2019 20:30:02 +0200 (CEST) Received: from zimbra.eo.pl ([127.0.0.1]) by localhost (mailfe1.internal [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FgA4mMJRheah; Mon, 15 Apr 2019 20:30:02 +0200 (CEST) Received: from kvm221.tbg.eo.pl (gnl93.internetdsl.tpnet.pl [83.3.89.93]) by mailfe1.internal (Postfix) with ESMTPSA id 664CE89498; Mon, 15 Apr 2019 20:30:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at eo.pl From: Adrian Brzezinski To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 20:29:43 +0200 Message-Id: <1555352983-1040-3-git-send-email-adrian.brzezinski@eo.pl> In-Reply-To: <1555352983-1040-1-git-send-email-adrian.brzezinski@eo.pl> References: <1555085449-1835-1-git-send-email-adrian.brzezinski@eo.pl> <1555352983-1040-1-git-send-email-adrian.brzezinski@eo.pl> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 15 Apr 2019 18:30:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 15 Apr 2019 18:30:18 +0000 (UTC) for IP:'217.17.46.141' DOMAIN:'zimbra.eo.pl' HELO:'zimbra.eo.pl' FROM:'adrian.brzezinski@eo.pl' RCPT:'' X-RedHat-Spam-Score: -0.01 (RCVD_IN_DNSWL_NONE) 217.17.46.141 zimbra.eo.pl 217.17.46.141 zimbra.eo.pl X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Adrian Brzezinski , Adrian Brzezinski Subject: [libvirt] [PATCH v2 2/2] news: cleanup in virNetTLSContextNew 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 15 Apr 2019 18:30:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Adrian Brzezinski --- docs/news.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 86c7734..9338381 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -51,6 +51,16 @@
+ + + rpc: cleanup in virNetTLSContextNew + + + Failed new gnutls context allocations in virNetTLSContextNew + function results in double free and segfault. Occasional memory + leaks may also occur. + +
--=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list