[gnome-settings-daemon/rhel/account-and-subman-plugins: 5/14] smartcard: Cancel cancellable when stopping
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/rhel/account-and-subman-plugins: 5/14] smartcard: Cancel cancellable when stopping
- Date: Wed, 26 Aug 2020 17:49:33 +0000 (UTC)
commit cf7cf6b04441f172d8014b1869f8ee3cec29b66c
Author: Marek Kasik <mkasik redhat com>
Date: Wed May 22 14:56:42 2019 +0200
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()
and initialize pointer to PK11SlotInfo.
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.
plugins/smartcard/gsd-smartcard-manager.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/plugins/smartcard/gsd-smartcard-manager.c b/plugins/smartcard/gsd-smartcard-manager.c
index 94ffdd90..09ccecc0 100644
--- a/plugins/smartcard/gsd-smartcard-manager.c
+++ b/plugins/smartcard/gsd-smartcard-manager.c
@@ -184,7 +184,7 @@ watch_one_event_from_driver (GsdSmartcardManager *self,
GError **error)
{
GsdSmartcardManagerPrivate *priv = self->priv;
- PK11SlotInfo *card, *old_card;
+ PK11SlotInfo *card = NULL, *old_card;
CK_SLOT_ID slot_id;
gulong handler_id;
int old_slot_series = -1, slot_series;
@@ -194,7 +194,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);
@@ -791,6 +792,8 @@ gsd_smartcard_manager_stop (GsdSmartcardManager *self)
g_debug ("Stopping smartcard manager");
+ g_cancellable_cancel (priv->cancellable);
+
unload_nss (self);
g_clear_object (&priv->settings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]