From nobody Mon Feb 9 05:00:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612285111; cv=none; d=zohomail.com; s=zohoarc; b=FccwPVlfMYB2ZzV02Gmu50sW8zRlvvAujXNkGdYUVW9gZ9m2rwQuOEQE3s+IZ/2BrOoOC5NWSP4FCNog6zPqIne97imMDrOPfI6iSGS6vsUe6x+aRuW7S2PwAu4DglI6dunjdaa1uEjBpPYWr6odgmrpZ2QwGjkBwadms5xCtGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612285111; 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; bh=PhAJ0IuqxTV6hwCUNDQf5jReWU/tZGf1DxWSUFXTt/Y=; b=SPbVfPn7fOyvNreKnGjDEaAJp1kht9UeTGhp79Va633CqGmhsAF9Xajz6YIq7SJEzlFxKX27uc0dMhg8NmcFJczMX/aJaSDWMFJvNAXQyeHsB8gOajQvtOwNzk3WyBSaDYNQzjGbCvaq7K4/uxzpSIq7Z52jbl989ew2fbHBhE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612285111526228.50355709193866; Tue, 2 Feb 2021 08:58:31 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-514-Oe1e9-iKOU6wkUNcJfURjg-1; Tue, 02 Feb 2021 11:57:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E7C1100A633; Tue, 2 Feb 2021 16:56:55 +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 1824977711; Tue, 2 Feb 2021 16:56:54 +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 D236918089D2; Tue, 2 Feb 2021 16:56:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 112GuqYg015095 for ; Tue, 2 Feb 2021 11:56:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id C96B46EF41; Tue, 2 Feb 2021 16:56:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 596AF6E510 for ; Tue, 2 Feb 2021 16:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612285110; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PhAJ0IuqxTV6hwCUNDQf5jReWU/tZGf1DxWSUFXTt/Y=; b=RBldcaPRhmqYRpOENPI5hI5MEuiPt38xPvEkV3B1wqQ7BQrIj9Y6ZH9+UrqXYMaYMrkqAA be2PdSfsT5BSiYvE1UBUvk6a0vfs2BCf7SI9P5IHocyo0jmpcNhKb8JZ55MprvzFp68c4v zQ58ALHWqC93lTS/yVXIwLlBdXuWWh0= X-MC-Unique: Oe1e9-iKOU6wkUNcJfURjg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 13/27] virStorageBackendRBDOpenRADOSConn: Use virSecureErase instead of VIR_DISPOSE_N Date: Tue, 2 Feb 2021 17:55:50 +0100 Message-Id: <72d4b3c080a82afd3fda1a23ac0335f79a27b791.1612284661.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Switch the secret value to 'g_autofree' for handling of the memory and clear it out using virSecureErase. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/storage/storage_backend_rbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backen= d_rbd.c index 22f5c78591..1f83205dfa 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -35,6 +35,7 @@ #include "rbd/librbd.h" #include "virsecret.h" #include "storage_util.h" +#include "virsecureerase.h" #define VIR_FROM_THIS VIR_FROM_STORAGE @@ -185,7 +186,7 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDS= tatePtr ptr, int ret =3D -1; virStoragePoolSourcePtr source =3D &def->source; virStorageAuthDefPtr authdef =3D source->auth; - unsigned char *secret_value =3D NULL; + g_autofree unsigned char *secret_value =3D NULL; size_t secret_value_size =3D 0; VIR_AUTODISPOSE_STR rados_key =3D NULL; g_auto(virBuffer) mon_host =3D VIR_BUFFER_INITIALIZER; @@ -215,6 +216,7 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDS= tatePtr ptr, goto cleanup; rados_key =3D g_base64_encode(secret_value, secret_value_size); + virSecureErase(secret_value, secret_value_size); if (virStorageBackendRBDRADOSConfSet(ptr->cluster, "key", rados_key) < 0) @@ -325,8 +327,6 @@ virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDS= tatePtr ptr, ret =3D 0; cleanup: - VIR_DISPOSE_N(secret_value, secret_value_size); - virObjectUnref(conn); return ret; } --=20 2.29.2