Compare commits

..

No commits in common. "f483fc844785bda4f52641d24b7b3ed3bfedee19" and "c380cf89000d116e4d564238685cee87a237cdf0" have entirely different histories.

7 changed files with 1 additions and 243 deletions

View File

@ -1,33 +0,0 @@
From 990b4136608ad1ae69e9727ccb16b9ecf88644e5 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Mon, 20 Nov 2023 17:49:46 +0100
Subject: [PATCH] lvm-dbus: Fix leaking error
---
src/plugins/lvm-dbus.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
index e822bd6..e1a9079 100644
--- a/src/plugins/lvm-dbus.c
+++ b/src/plugins/lvm-dbus.c
@@ -362,10 +362,14 @@ void bd_lvm_close (void) {
/* the check() call should create the DBus connection for us, but let's not
completely rely on it */
- if (!g_dbus_connection_flush_sync (bus, NULL, &error))
+ if (!g_dbus_connection_flush_sync (bus, NULL, &error)) {
bd_utils_log_format (BD_UTILS_LOG_CRIT, "Failed to flush DBus connection: %s", error->message);
- if (!g_dbus_connection_close_sync (bus, NULL, &error))
+ g_clear_error (&error);
+ }
+ if (!g_dbus_connection_close_sync (bus, NULL, &error)) {
bd_utils_log_format (BD_UTILS_LOG_CRIT, "Failed to close DBus connection: %s", error->message);
+ g_clear_error (&error);
+ }
dm_log_with_errno_init (NULL);
dm_log_init_verbose (0);
--
2.27.0

View File

@ -1,24 +0,0 @@
From e6810f64f49d789099b96d69ae25705c6bdbe7c9 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Tue, 26 Mar 2024 14:04:27 +0100
Subject: [PATCH] lvm-dbus: Fix leaking error in bd_lvm_init
---
src/plugins/lvm-dbus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
index e822bd6..a9c1d11 100644
--- a/src/plugins/lvm-dbus.c
+++ b/src/plugins/lvm-dbus.c
@@ -337,6 +337,7 @@ gboolean bd_lvm_init (void) {
completely rely on it */
if (G_UNLIKELY (!bus) && !setup_dbus_connection (&error)) {
bd_utils_log_format (BD_UTILS_LOG_CRIT, "Failed to setup DBus connection: %s", error->message);
+ g_clear_error (&error);
return FALSE;
}
--
2.43.0

View File

@ -1,38 +0,0 @@
From 5a148f4b94fb047c6bbf4cdbc54504207560e94c Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 12 Jul 2024 15:13:33 +0800
Subject: [PATCH] nvme: Fix potential memory leak
This should not happen in practice when the NVMe spec
is thoroughly followed.
---
src/plugins/nvme/nvme-info.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/nvme/nvme-info.c b/src/plugins/nvme/nvme-info.c
index eaf7747..947b1f0 100644
--- a/src/plugins/nvme/nvme-info.c
+++ b/src/plugins/nvme/nvme-info.c
@@ -672,16 +672,19 @@ BDNVMENamespaceInfo *bd_nvme_get_namespace_info (const gchar *device, GError **e
switch (d->nidt) {
case NVME_NIDT_EUI64:
+ g_free (info->eui64);
info->eui64 = g_malloc0 (d->nidl * 2 + 1);
for (i = 0; i < d->nidl; i++)
snprintf (info->eui64 + i * 2, 3, "%02x", d->nid[i]);
break;
case NVME_NIDT_NGUID:
+ g_free (info->nguid);
info->nguid = g_malloc0 (d->nidl * 2 + 1);
for (i = 0; i < d->nidl; i++)
snprintf (info->nguid + i * 2, 3, "%02x", d->nid[i]);
break;
case NVME_NIDT_UUID:
+ g_free (info->uuid);
info->uuid = _uuid_to_str (d->nid);
break;
case NVME_NIDT_CSI:
--
2.33.0

View File

@ -1,37 +0,0 @@
From 32a3ec7e47243ea2c2530445df83f60f992f0c23 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 6 Nov 2023 18:38:34 +0100
Subject: [PATCH] part: Fix potential double free when getting parttype
fdisk_partition_get_type returns a pointer to a static table so
we shouldn't free it. fdisk_unref_parttype should against this but
we see some double free crashes that could be caused by this.
Related: https://github.com/storaged-project/udisks/issues/1208
---
src/plugins/part.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/plugins/part.c b/src/plugins/part.c
index 46d31137..20bb3628 100644
--- a/src/plugins/part.c
+++ b/src/plugins/part.c
@@ -462,7 +462,6 @@ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_nu
if (!ptype_string) {
g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL,
"Failed to get partition type for partition %d on device '%s'", part_num, device);
- fdisk_unref_parttype (ptype);
fdisk_unref_partition (pa);
close_context (cxt);
return NULL;
@@ -470,7 +469,6 @@ static gchar* get_part_type_guid_and_gpt_flags (const gchar *device, int part_nu
ret = g_strdup (ptype_string);
- fdisk_unref_parttype (ptype);
fdisk_unref_partition (pa);
close_context (cxt);
return ret;
--
2.27.0

View File

@ -1,49 +0,0 @@
From 1b6d24e0ec4fc50686a533ec209f7b1db952deb5 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 3 Apr 2024 15:58:04 +0200
Subject: [PATCH] crypto: Fix double free in bd_crypto_luks_remove_key
---
src/plugins/crypto.c | 1 -
tests/crypto_test.py | 6 ++++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c
index 3dabaabd..05931e80 100644
--- a/src/plugins/crypto.c
+++ b/src/plugins/crypto.c
@@ -1479,7 +1479,6 @@ gboolean bd_crypto_luks_remove_key (const gchar *device, BDCryptoKeyslotContext
return FALSE;
}
- crypt_safe_free (key_buf);
crypt_free (cd);
bd_utils_report_finished (progress_id, "Completed");
return TRUE;
diff --git a/tests/crypto_test.py b/tests/crypto_test.py
index 4d920c27..efe892b2 100644
--- a/tests/crypto_test.py
+++ b/tests/crypto_test.py
@@ -524,6 +524,9 @@ class CryptoTestRemoveKey(CryptoTestCase):
succ = BlockDev.crypto_luks_add_key(self.loop_dev, ctx, nctx2)
self.assertTrue(succ)
+ nctx3 = BlockDev.CryptoKeyslotContext(keyfile=self.keyfile)
+ succ = BlockDev.crypto_luks_add_key(self.loop_dev, ctx, nctx3)
+
with self.assertRaises(GLib.GError):
wctx = BlockDev.CryptoKeyslotContext(passphrase="wrong-passphrase")
BlockDev.crypto_luks_remove_key(self.loop_dev, wctx)
@@ -534,6 +537,9 @@ class CryptoTestRemoveKey(CryptoTestCase):
succ = BlockDev.crypto_luks_remove_key(self.loop_dev, nctx2)
self.assertTrue(succ)
+ succ = BlockDev.crypto_luks_remove_key(self.loop_dev, nctx3)
+ self.assertTrue(succ)
+
@tag_test(TestTags.SLOW)
def test_luks_remove_key(self):
self._remove_key(self._luks_format)
--
2.27.0

View File

@ -1,25 +0,0 @@
From 9caf89e4449e5e4cea7f61a7377c77a69d7cad94 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 5 Aug 2024 10:03:59 +0800
Subject: [PATCH] part: Fix copy-paste bug in bd_part_spec_copy
---
src/lib/plugin_apis/part.api | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/plugin_apis/part.api b/src/lib/plugin_apis/part.api
index 41cc30c..a4e8ee4 100644
--- a/src/lib/plugin_apis/part.api
+++ b/src/lib/plugin_apis/part.api
@@ -82,7 +82,7 @@ BDPartSpec* bd_part_spec_copy (BDPartSpec *data) {
ret->path = g_strdup (data->path);
ret->name = g_strdup (data->name);
- ret->name = g_strdup (data->uuid);
+ ret->uuid = g_strdup (data->uuid);
ret->id = g_strdup (data->id);
ret->type_guid = g_strdup (data->type_guid);
ret->type = data->type;
--
2.33.0

View File

@ -3,19 +3,13 @@
Name: libblockdev
Version: 3.0.4
Release: 9
Release: 4
Summary: libblockdev is a C library supporting GObject introspection for manipulation of block devices
License: LGPLv2+
URL: https://github.com/storaged-project/libblockdev
Source0: https://github.com/storaged-project/libblockdev/releases/download/%{version}-1/%{name}-%{version}.tar.gz
Patch1: 0001-Add-BDPluginSpec-constructor-and-use-it-in-plugin_sp.patch
Patch2: 0002-Fix-leaking-error.patch
Patch3: 0003-lvm-dbus-Fix-leaking-error-in-bd_lvm_init.patch
Patch4: 0004-nvme-Fix-potential-memory-leak.patch
Patch5: 0005-part-Fix-potential-double-free-when-getting-parttype.patch
Patch6: 0006-crypto-Fix-double-free-in-bd_crypto_luks_remove_key.patch
Patch7: 0007-part-Fix-copy-paste-bug-in-bd_part_spec_copy.patch
BuildRequires: make glib2-devel libyaml-devel libbytesize-devel parted-devel libuuid-devel ndctl-devel device-mapper-devel
BuildRequires: device-mapper-devel systemd-devel nss-devel volume_key-devel >= 0.3.9-7 libblkid-devel libmount-devel
@ -165,36 +159,6 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%changelog
* Mon Aug 5 2024 cenhuilin <cenhuilin@kylinos.cn> - 3.0.4-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:part: Fix copy-paste bug in bd_part_spec_copy
* Mon Jul 22 2024 kouwenqi <kouwenqi@kylinos.cn> - 3.0.4-8
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix double free in crypto.c and part.c
* Fri Jul 12 2024 cenhuilin <cenhuilin@kylinos.cn> - 3.0.4-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:nvme: Fix potential memory leak
* Tue Jun 25 2024 liuh <liuhuan01@kylinos.cn> - 3.0.4-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:lvm-dbus: Fix leaking error in bd_lvm_init
* Sat May 11 2024 yanshuai <yanshuai@kylinos.cn> - 3.0.4-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:lvm-dbus: Fix leaking error
* Wed Apr 3 2024 wangzhiqiang <swangzhiqiang95@huawei.com> - 3.0.4-4
- Type:bugfix
- ID:NA