Backport mozbz#1381784 to avoid deadlock in dnf

This commit is contained in:
Daiki Ueno 2017-07-18 13:18:15 +02:00
parent c51947784e
commit 10a811eb16
2 changed files with 43 additions and 1 deletions

36
nss-devslot-lock.patch Normal file
View File

@ -0,0 +1,36 @@
# HG changeset patch
# User Daiki Ueno <dueno@redhat.com>
# Date 1500370430 -7200
# Tue Jul 18 11:33:50 2017 +0200
# Branch wip/dueno/devslot-lock
# Node ID 421c812e3143b3f7e62825cb5749e5239412c56b
# Parent 4c1358d767de5da9a5f34afc2821b281fb37ca57
Avoid deadlock in nssSlot_IsTokenPresent
diff --git a/lib/dev/devslot.c b/lib/dev/devslot.c
--- a/lib/dev/devslot.c
+++ b/lib/dev/devslot.c
@@ -226,15 +226,17 @@ nssSlot_GetToken(
NSSSlot *slot)
{
NSSToken *rvToken = NULL;
- nssSlot_EnterMonitor(slot);
- /* Even if a token should be present, check `slot->token` too as it
- * might be gone already. This would happen mostly on shutdown. */
- if (nssSlot_IsTokenPresent(slot) && slot->token) {
- rvToken = nssToken_AddRef(slot->token);
+ if (nssSlot_IsTokenPresent(slot)) {
+ /* Even if a token should be present, check `slot->token` too as it
+ * might be gone already. This would happen mostly on shutdown. */
+ nssSlot_EnterMonitor(slot);
+ if (slot->token) {
+ rvToken = nssToken_AddRef(slot->token);
+ }
+ nssSlot_ExitMonitor(slot);
}
- nssSlot_ExitMonitor(slot);
return rvToken;
}

View File

@ -21,7 +21,7 @@ Name: nss
Version: 3.31.0
# for Rawhide, please always use release >= 2
# for Fedora release branches, please use release < 2 (1.0, 1.1, ...)
Release: 1.0%{?dist}
Release: 1.1%{?dist}
License: MPLv2.0
URL: http://www.mozilla.org/projects/security/pki/nss/
Group: System Environment/Libraries
@ -112,6 +112,8 @@ Patch58: rhbz1185708-enable-ecc-3des-ciphers-by-default.patch
Patch59: nss-check-policy-file.patch
Patch62: nss-skip-util-gtest.patch
Patch66: nss-gtests-split.patch
# Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1381784
Patch67: nss-devslot-lock.patch
%description
Network Security Services (NSS) is a set of libraries designed to
@ -196,6 +198,7 @@ pushd nss
%patch59 -p1 -b .check_policy_file
%patch62 -p1 -b .skip_util_gtest
%patch66 -p1 -b .gtests-split
%patch67 -p1 -b .devslot-lock
popd
#########################################################
@ -797,6 +800,9 @@ fi
%changelog
* Tue Jul 18 2017 Daiki Ueno <dueno@redhat.com> - 3.31.0-1.1
- Backport mozbz#1381784 to avoid deadlock in dnf
* Wed Jun 21 2017 Daiki Ueno <dueno@redhat.com> - 3.31.0-1.0
- Rebase to NSS 3.31.0