summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-04-18 13:02:42 +0200
committerOndrej Holy <oholy@redhat.com>2016-04-18 16:38:02 +0200
commit874a51730e68b63544c748373237baba58f1b0a6 (patch)
treed2861bdb83dd09bd40ea87ae58bead5c22e486fc /monitor
parent4a156988465cb86ee40f0d4454f5c38f895b92f8 (diff)
downloadgvfs-874a51730e68b63544c748373237baba58f1b0a6.tar.gz
udisks2: Fix crash when mounting encrypted volume
Code handling external unlocks during mount operation was added by the commit beea21e recently. Unfortunately, it may cause crashes due to accessing already freed memory, because gvfs_udisks2_volume_monitor_update waits for pending dbus messages using udisks_client_settle, thus another main context iteration may happen (i.e. mount operation may finish and mount data may be freed) before accessing mount data pointer. The mount data pointer has to be obtained after gvfs_udisks2_volume_monitor_update call in order to fix this crashes. https://bugzilla.gnome.org/show_bug.cgi?id=765146
Diffstat (limited to 'monitor')
-rw-r--r--monitor/udisks2/gvfsudisks2volume.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index 8bb572d9..20153396 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -608,10 +608,11 @@ on_udisks_client_changed (UDisksClient *client,
gpointer user_data)
{
GVfsUDisks2Volume *volume = GVFS_UDISKS2_VOLUME (user_data);
- MountData *data = volume->mount_pending_op;
+ MountData *data;
update_volume_on_event (volume);
+ data = volume->mount_pending_op;
if (data && data->mount_operation_aborted_handler_id && data->encrypted_to_unlock)
{
UDisksBlock *cleartext_block;