Skip to content

Commit

Permalink
8293232: Fix race condition in pkcs11 SessionManager
Browse files Browse the repository at this point in the history
Backport-of: 1e031e6a5886fba3009d8e5fa62416fe15a901b6
  • Loading branch information
zzambers authored and GoeLin committed Oct 3, 2022
1 parent 3bcdb66 commit 67f31bb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -207,7 +207,12 @@ void demoteObjSession(Session session) {
// will be added to correct pool on release, nothing to do now
return;
}
opSessions.release(session);
// Objects could have been added to this session by other thread between
// check in Session.removeObject method and objSessions.remove call
// higher. Therefore releaseSession method, which performs additional
// check for objects, is used here to avoid placing this session
// in wrong pool due to race condition.
releaseSession(session);
}

private Session openSession() throws PKCS11Exception {
Expand Down

3 comments on commit 67f31bb

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zzambers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 67f31bb Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zzambers the backport was successfully created on the branch zzambers-backport-67f31bb9 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 67f31bb9 from the openjdk/jdk17u-dev repository.

The commit being backported was authored by Zdenek Zambersky on 3 Oct 2022 and had no reviewers.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev zzambers-backport-67f31bb9:zzambers-backport-67f31bb9
$ git checkout zzambers-backport-67f31bb9
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev zzambers-backport-67f31bb9

Please sign in to comment.