summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2019-05-22 14:56:42 +0200
committerMarek Kasik <mkasik@redhat.com>2019-05-22 15:27:44 +0200
commita1c2685bc6b255f22b6ce4645c001d428cb67907 (patch)
tree756135ef9aef9b7233c066919cba3bc3d4f2ffab
parent6b80bddb2d60c7db8b6c2297cc2cf6ce6adbef12 (diff)
downloadgnome-settings-daemon-a1c2685bc6b255f22b6ce4645c001d428cb67907.tar.gz
smartcard: Cancel cancellable when stopping
self->cancellable in GsdSmartcardManager is not cancelled at gsd_smartcard_manager_stop() and hence some callbacks are still called after unload_nss() which clears SECMODListLock which is used by SECMOD_GetReadLock() / SECMOD_ReleaseReadLock(). This leads to crashes in NSSRWLock_LockRead_Util() and NSSRWLock_UnlockRead_Util() probably. Also check for return value of g_cancellable_connect(). See https://bugzilla.redhat.com/show_bug.cgi?id=1646359, https://bugzilla.redhat.com/show_bug.cgi?id=1688791 and their duplicates for additional info.
-rw-r--r--plugins/smartcard/gsd-smartcard-manager.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index 014c17be..da1e0d6d 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -190,7 +190,8 @@ watch_one_event_from_driver (GsdSmartcardManager *self,
operation,
NULL);
- card = SECMOD_WaitForAnyTokenEvent (operation->driver, 0, PR_SecondsToInterval (1));
+ if (handler_id != 0)
+ card = SECMOD_WaitForAnyTokenEvent (operation->driver, 0, PR_SecondsToInterval (1));
g_cancellable_disconnect (cancellable, handler_id);
@@ -773,6 +774,8 @@ gsd_smartcard_manager_stop (GsdSmartcardManager *self)
{
g_debug ("Stopping smartcard manager");
+ g_cancellable_cancel (self->cancellable);
+
unload_nss (self);
g_clear_object (&self->settings);