cert_InitLocks does not properly reset certRefCountLock to NULL after calling PZ_DestroyLock(certRefCountLock)

VERIFIED FIXED in 3.13.4

Status

P2
normal
VERIFIED FIXED
7 years ago
7 years ago

People

(Reporter: benchan, Assigned: benchan)

Tracking

3.11.9
3.13.4

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

7 years ago
Created attachment 611526 [details] [diff] [review]
cert_init_locks.patch

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19

Steps to reproduce:

By going through the cert_InitLocks in nss-3.13.3/mozilla/security/nss/lib/certdb/certdb.c

SECStatus
cert_InitLocks(void)
{
    if ( certRefCountLock == NULL ) {
        certRefCountLock = PZ_NewLock(nssILockRefLock);
        PORT_Assert(certRefCountLock != NULL);
        if (!certRefCountLock) {
            return SECFailure;
        }
    }

    if ( certTrustLock == NULL ) {
        certTrustLock = PZ_NewLock(nssILockCertDB);
        PORT_Assert(certTrustLock != NULL);
        if (!certTrustLock) {
            PZ_DestroyLock(certRefCountLock);
            return SECFailure;
        }
    }    

    return SECSuccess;
}


Actual results:

certRefCountLock holds a reference to the lock that may have been destroyed by PZ_DestroyLock(certRefCountLock).


Expected results:

certRefCountLock should be reset to NULL after PZ_DestroyLock(certRefCountLock) is called.

Updated

7 years ago
Attachment #611526 - Attachment is patch: true
Attachment #611526 - Flags: review?(wtc)

Comment 1

7 years ago
Comment on attachment 611526 [details] [diff] [review]
cert_init_locks.patch

r=wtc.  Thanks for the patch.

Patch checked in on the NSS trunk and NSS_3_13_4_BRANCH
for NSS 3.13.4.

Checking in certdb.c;
/cvsroot/mozilla/security/nss/lib/certdb/certdb.c,v  <--  certdb.c
new revision: 1.122; previous revision: 1.121
done

Checking in certdb.c;
/cvsroot/mozilla/security/nss/lib/certdb/certdb.c,v  <--  certdb.c
new revision: 1.121.2.1; previous revision: 1.121
done
Attachment #611526 - Flags: review?(wtc) → review+

Comment 2

7 years ago
This bug was introduced in the fix for bug 399304.
Assignee: nobody → benchan
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → 3.13.4
Version: 3.13.3 → 3.11.9
(Assignee)

Comment 3

7 years ago
Verified that the patch has been committed to NSS trunk and NSS_3_13_4_BRANCH. Thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.