udisks2: Correct add to hash table for items which can clash in the monitor
Related: RHEL-143934
This commit is contained in:
parent
a33223d1b7
commit
0465b2092b
@ -22,7 +22,7 @@
|
||||
|
||||
Name: gvfs
|
||||
Version: 1.48.1
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: Backends for the gio framework in GLib
|
||||
|
||||
License: GPLv3 and LGPLv2+ and BSD and MPLv2.0
|
||||
@ -50,6 +50,7 @@ Patch10: udisks2-monitor-performance-202.patch
|
||||
Patch11: udisks2-monitor-performance-230.patch
|
||||
Patch12: udisks2-monitor-performance-273.patch
|
||||
Patch13: udisks2-monitor-performance-290.patch
|
||||
Patch14: udisks2-monitor-performance-297.patch
|
||||
|
||||
BuildRequires: meson
|
||||
BuildRequires: gcc
|
||||
@ -447,6 +448,9 @@ killall -USR1 gvfsd >&/dev/null || :
|
||||
%{_datadir}/installed-tests
|
||||
|
||||
%changelog
|
||||
* Fri Feb 06 2026 Milan Crha <mcrha@redhat.com> - 1.48.1-8
|
||||
- udisks2: Correct add to hash table for items which can clash in the monitor (RHEL-143934)
|
||||
|
||||
* Mon Jan 26 2026 Milan Crha <mcrha@redhat.com> - 1.48.1-7
|
||||
- udisks2: Use hash table for quicker lookups in the monitor (RHEL-143934)
|
||||
|
||||
|
||||
37
udisks2-monitor-performance-297.patch
Normal file
37
udisks2-monitor-performance-297.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From 3e3691a59b69aeafac4288e0599fca3eb4cb02f3 Mon Sep 17 00:00:00 2001
|
||||
Date: Tue, 3 Feb 2026 19:15:32 +0100
|
||||
Subject: [PATCH] udisks2: Fix memory corruption with duplicate mount paths
|
||||
|
||||
Calling g_hash_table_insert on a key that already exists in the table frees
|
||||
the old value and the *new* key, thus leaving the old key pointing to free'd
|
||||
memory. g_hash_table_replace instead frees the old value and key together
|
||||
and inserts the new value and key into the table.
|
||||
---
|
||||
monitor/udisks2/gvfsudisks2volumemonitor.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
|
||||
index c57249e5..aa1ca7a3 100644
|
||||
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
|
||||
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
|
||||
@@ -730,7 +730,7 @@ update_all (GVfsUDisks2VolumeMonitor *monitor,
|
||||
for (link = entries; link != NULL; link = g_list_next (link))
|
||||
{
|
||||
GUnixMountEntry *mount_entry = link->data;
|
||||
- g_hash_table_insert (mount_entries, (gpointer) g_unix_mount_get_mount_path (mount_entry), mount_entry);
|
||||
+ g_hash_table_replace (mount_entries, (gpointer) g_unix_mount_get_mount_path (mount_entry), mount_entry);
|
||||
}
|
||||
/* the mount_entries took ownership of the mount entry objects */
|
||||
g_list_free (entries);
|
||||
@@ -742,7 +742,7 @@ update_all (GVfsUDisks2VolumeMonitor *monitor,
|
||||
for (link = points; link != NULL; link = g_list_next (link))
|
||||
{
|
||||
GUnixMountPoint *mount_point = link->data;
|
||||
- g_hash_table_insert (mount_points_by_path, (gpointer) g_unix_mount_point_get_mount_path (mount_point), mount_point);
|
||||
+ g_hash_table_replace (mount_points_by_path, (gpointer) g_unix_mount_point_get_mount_path (mount_point), mount_point);
|
||||
}
|
||||
/* the mount_points_by_path took ownership of the mount point objects */
|
||||
g_list_free (points);
|
||||
--
|
||||
GitLab
|
||||
|
||||
Loading…
Reference in New Issue
Block a user