538d1b
From 7a0e344d0642f76992c943158621d8ee7e5caea3 Mon Sep 17 00:00:00 2001
538d1b
From: Vojtech Trefny <vtrefny@redhat.com>
538d1b
Date: Tue, 15 Nov 2022 13:21:25 +0100
538d1b
Subject: [PATCH 1/2] crypto: Fix GError overwrite from libvolume_key
538d1b
538d1b
---
538d1b
 src/plugins/crypto.c | 7 ++++---
538d1b
 1 file changed, 4 insertions(+), 3 deletions(-)
538d1b
538d1b
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
538d1b
index 35c38410..9064c8e3 100644
538d1b
--- a/src/plugins/crypto.c
538d1b
+++ b/src/plugins/crypto.c
538d1b
@@ -2552,13 +2552,14 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
538d1b
     GIOChannel *out_file = NULL;
538d1b
     GIOStatus status = G_IO_STATUS_ERROR;
538d1b
     gsize bytes_written = 0;
538d1b
+    GError *l_error = NULL;
538d1b
 
538d1b
     packet_data = libvk_volume_create_packet_asymmetric_with_format (volume, &packet_data_size, secret_type, cert,
538d1b
-                                                                     ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, error);
538d1b
-
538d1b
+                                                                     ui, LIBVK_PACKET_FORMAT_ASYMMETRIC_WRAP_SECRET_ONLY, &l_error);
538d1b
     if (!packet_data) {
538d1b
         g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
538d1b
-                     "Failed to get escrow data");
538d1b
+                     "Failed to get escrow data: %s", l_error->message);
538d1b
+        g_clear_error (&l_error);
538d1b
         libvk_volume_free (volume);
538d1b
         return FALSE;
538d1b
     }
538d1b
-- 
538d1b
2.38.1
538d1b
538d1b
538d1b
From 25bf34c4c03e37eb3782dfccf459b9a3f795ddb3 Mon Sep 17 00:00:00 2001
538d1b
From: Vojtech Trefny <vtrefny@redhat.com>
538d1b
Date: Wed, 16 Nov 2022 10:26:06 +0100
538d1b
Subject: [PATCH 2/2] crypto: Fix double free in write_escrow_data_file
538d1b
538d1b
---
538d1b
 src/plugins/crypto.c | 1 -
538d1b
 1 file changed, 1 deletion(-)
538d1b
538d1b
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
538d1b
index 9064c8e3..2086209e 100644
538d1b
--- a/src/plugins/crypto.c
538d1b
+++ b/src/plugins/crypto.c
538d1b
@@ -2560,7 +2560,6 @@ static gboolean write_escrow_data_file (struct libvk_volume *volume, struct libv
538d1b
         g_set_error (error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_ESCROW_FAILED,
538d1b
                      "Failed to get escrow data: %s", l_error->message);
538d1b
         g_clear_error (&l_error);
538d1b
-        libvk_volume_free (volume);
538d1b
         return FALSE;
538d1b
     }
538d1b
 
538d1b
-- 
538d1b
2.38.1
538d1b