Skip to content

Commit 51cde1a

Browse files
committed
8277970: Test jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java fails with "tag mismatch"
Backport-of: d1252653b07ee3d0347b39b96f734e45772b5b36
1 parent 29dc97e commit 51cde1a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ private Plaintext[] decodeInputRecord() throws IOException, BadPaddingException
255255
// Decrypt the fragment
256256
//
257257
ByteBuffer fragment;
258+
recordLock.lock();
258259
try {
260+
if (isClosed) {
261+
return null;
262+
}
259263
Plaintext plaintext =
260264
readCipher.decrypt(contentType, recordBody, null);
261265
fragment = plaintext.fragment;
@@ -265,6 +269,8 @@ private Plaintext[] decodeInputRecord() throws IOException, BadPaddingException
265269
} catch (GeneralSecurityException gse) {
266270
throw (SSLProtocolException)(new SSLProtocolException(
267271
"Unexpected exception")).initCause(gse);
272+
} finally {
273+
recordLock.unlock();
268274
}
269275

270276
if (contentType != ContentType.HANDSHAKE.id &&

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,6 @@ javax/security/auth/kerberos/KerberosTixDateTest.java 8039280 generic-
672672
sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java 8039280 generic-all
673673
sun/security/provider/PolicyParser/ExtDirsChange.java 8039280 generic-all
674674
sun/security/provider/PolicyParser/PrincipalExpansionError.java 8039280 generic-all
675-
sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java 8277970 linux-all,macosx-x64
676675

677676
############################################################################
678677

test/jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
3030

3131
/*
3232
* @test
33-
* @bug 8274736
33+
* @bug 8274736 8277970
3434
* @summary Concurrent read/close of SSLSockets causes SSLSessions to be
3535
* invalidated unnecessarily
3636
* @library /javax/net/ssl/templates

0 commit comments

Comments
 (0)