|
|
618927 |
From a1c2685bc6b255f22b6ce4645c001d428cb67907 Mon Sep 17 00:00:00 2001
|
|
|
618927 |
From: Marek Kasik <mkasik@redhat.com>
|
|
|
618927 |
Date: Wed, 22 May 2019 14:56:42 +0200
|
|
|
618927 |
Subject: [PATCH] smartcard: Cancel cancellable when stopping
|
|
|
618927 |
|
|
|
618927 |
self->cancellable in GsdSmartcardManager is not cancelled
|
|
|
618927 |
at gsd_smartcard_manager_stop() and hence some callbacks are
|
|
|
618927 |
still called after unload_nss() which clears SECMODListLock
|
|
|
618927 |
which is used by SECMOD_GetReadLock() / SECMOD_ReleaseReadLock().
|
|
|
618927 |
|
|
|
618927 |
This leads to crashes in NSSRWLock_LockRead_Util() and
|
|
|
618927 |
NSSRWLock_UnlockRead_Util() probably.
|
|
|
618927 |
|
|
|
618927 |
Also check for return value of g_cancellable_connect()
|
|
|
618927 |
and initialize pointer to PK11SlotInfo.
|
|
|
618927 |
|
|
|
618927 |
See https://bugzilla.redhat.com/show_bug.cgi?id=1646359,
|
|
|
618927 |
https://bugzilla.redhat.com/show_bug.cgi?id=1688791 and
|
|
|
618927 |
their duplicates for additional info.
|
|
|
618927 |
---
|
|
|
618927 |
plugins/smartcard/gsd-smartcard-manager.c | 7 +++++--
|
|
|
618927 |
1 file changed, 5 insertions(+), 2 deletion(-)
|
|
|
618927 |
|
|
|
618927 |
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
|
|
|
618927 |
index 014c17be..da1e0d6d 100644
|
|
|
618927 |
--- a/plugins/smartcard/gsd-smartcard-manager.c
|
|
|
618927 |
+++ b/plugins/smartcard/gsd-smartcard-manager.c
|
|
|
618927 |
@@ -184,7 +184,7 @@
|
|
|
618927 |
GError **error)
|
|
|
618927 |
{
|
|
|
618927 |
GsdSmartcardManagerPrivate *priv = self->priv;
|
|
|
618927 |
- PK11SlotInfo *card, *old_card;
|
|
|
618927 |
+ PK11SlotInfo *card = NULL, *old_card;
|
|
|
618927 |
CK_SLOT_ID slot_id;
|
|
|
618927 |
gulong handler_id;
|
|
|
618927 |
int old_slot_series = -1, slot_series;
|
|
|
618927 |
@@ -190,7 +190,8 @@ watch_one_event_from_driver (GsdSmartcardManager *self,
|
|
|
618927 |
operation,
|
|
|
618927 |
NULL);
|
|
|
618927 |
|
|
|
618927 |
- card = SECMOD_WaitForAnyTokenEvent (operation->driver, 0, PR_SecondsToInterval (1));
|
|
|
618927 |
+ if (handler_id != 0)
|
|
|
618927 |
+ card = SECMOD_WaitForAnyTokenEvent (operation->driver, 0, PR_SecondsToInterval (1));
|
|
|
618927 |
|
|
|
618927 |
g_cancellable_disconnect (cancellable, handler_id);
|
|
|
618927 |
|
|
|
618927 |
@@ -773,6 +774,8 @@ gsd_smartcard_manager_stop (GsdSmartcardManager *self)
|
|
|
618927 |
|
|
|
618927 |
g_debug ("Stopping smartcard manager");
|
|
|
618927 |
|
|
|
618927 |
+ g_cancellable_cancel (priv->cancellable);
|
|
|
618927 |
+
|
|
|
618927 |
unload_nss (self);
|
|
|
618927 |
|
|
|
618927 |
g_clear_object (&priv->settings);
|
|
|
618927 |
--
|
|
|
618927 |
2.23.0
|
|
|
618927 |
|