From 16320528cc04ee87ce23cc4a2406b13e7b3c22bf Mon Sep 17 00:00:00 2001 From: cenhuilin Date: Thu, 21 Aug 2025 17:07:56 +0800 Subject: [PATCH] helpers: fixed memleak and misprint check for creating second BDCrypto context (cherry picked from commit 04eb766580bd7fdbd47f070349555b4eaa9b3006) --- ...for-creating-second-BDCrypto-context.patch | 26 +++++++++++++++++++ udisks2.spec | 6 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 0005-helpers-fixed-memleak-and-misprint-check-for-creating-second-BDCrypto-context.patch diff --git a/0005-helpers-fixed-memleak-and-misprint-check-for-creating-second-BDCrypto-context.patch b/0005-helpers-fixed-memleak-and-misprint-check-for-creating-second-BDCrypto-context.patch new file mode 100644 index 0000000..e86e303 --- /dev/null +++ b/0005-helpers-fixed-memleak-and-misprint-check-for-creating-second-BDCrypto-context.patch @@ -0,0 +1,26 @@ +From d0aab7358ec840a2707e8f8188e7cb72924ba7de Mon Sep 17 00:00:00 2001 +From: Herman Semenov +Date: Thu, 21 Aug 2025 16:50:48 +0800 +Subject: [PATCH] helpers: fixed memleak and misprint check for creating second BDCrypto context + +This fixed also fixes memory leak if ncontext is not created, context will be created successfully, then context malloc not free. +--- + src/udiskslinuxencryptedhelpers.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/udiskslinuxencryptedhelpers.c b/src/udiskslinuxencryptedhelpers.c +index 94a3183..ae88847 100644 +--- a/src/udiskslinuxencryptedhelpers.c ++++ b/src/udiskslinuxencryptedhelpers.c +@@ -106,7 +106,7 @@ gboolean luks_change_key_job_func (UDisksThreadedJob *job, + return FALSE; + ncontext = bd_crypto_keyslot_context_new_passphrase ((const guint8 *) data->new_passphrase->str, + data->new_passphrase->len, error); +- if (!context) ++ if (!ncontext) + { + bd_crypto_keyslot_context_free (context); + return FALSE; +-- +2.43.0 + diff --git a/udisks2.spec b/udisks2.spec index 048f389..5045899 100644 --- a/udisks2.spec +++ b/udisks2.spec @@ -19,7 +19,7 @@ Name: udisks2 Summary: Disk Manager Version: 2.10.1 -Release: 5 +Release: 6 License: GPL-2.0+ and LGPL-2.0+ Group: System Environment/Libraries URL: https://github.com/storaged-project/udisks @@ -29,6 +29,7 @@ Patch0001: 0001-mdraid-Expose-consistency_policy-sysfs-value.patch Patch0002: 0002-udiskslinuxmanager-use-dbus-interface-after-free.patch Patch0003: 0003-udiskslinuxblock-Fix-leaking-string.patch Patch0004: 0004-fix-CVE-2025-6019-udiskslinuxfilesystemhelpers-mount-with-nosuid-nodev.patch +Patch0005: 0005-helpers-fixed-memleak-and-misprint-check-for-creating-second-BDCrypto-context.patch BuildRequires: make BuildRequires: glib2-devel >= %{glib2_version} @@ -319,6 +320,9 @@ fi %changelog +* Thu Aug 21 2025 cenhuilin - 2.10.1-6 +- helpers: fixed memleak and misprint check for creating second BDCrypto context + * Mon Jun 23 2025 zhangjian - 2.10.1-5 - fix CVE-2025-6019 -- Gitee